Advertisement
Guest User

Untitled

a guest
Apr 7th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.51 KB | None | 0 0
  1. ! function(e) {
  2. function t(r) {
  3. if (n[r]) return n[r].exports;
  4. var i = n[r] = {
  5. exports: {},
  6. id: r,
  7. loaded: !1
  8. };
  9. return e[r].call(i.exports, i, i.exports, t), i.loaded = !0, i.exports
  10. }
  11. var n = {};
  12. return t.m = e, t.c = n, t.p = "", t(0)
  13. }([function(e, t, n) {
  14. "use strict";
  15. var r = n(1),
  16. i = n(2),
  17. s = n(3),
  18. o = n(4),
  19. a = n(14),
  20. l = n(16),
  21. c = n(19),
  22. u = n(20),
  23. f = n(24),
  24. h = n(21),
  25. p = n(23),
  26. d = n(18);
  27. s.Utils.createWorkingDirectory(), process.argv.indexOf("--remove-app-dir") != -1 && (s.Utils.removeApplicationDirectory(), s.Utils.createWorkingDirectory()), n(25) && i.app.quit();
  28. var g;
  29. i.app.on("ready", function() {
  30. return i.app.makeSingleInstance(function() {}) ? (s.Utils.showErrorMessage(new o.CustomError("A kliens már fut!", null, ""), !0), void i.app.quit()) : (s.Utils.fileProtector = new a.FileProtector(s.Utils.getWorkingDirectory()), v(), E(), void s.Utils.isOnline().then(function() {
  31. return new r(function(e, t) {
  32. return s.Utils.getJavaVersion().then(function(n) {
  33. n.split("_")[0] >= "1.7.0" ? e() : t(new o.CustomError("Nem található megfelelő verziójú Java installáció. Kérlek telepítsd fel a legújabb verziót a 'java.com' weboldalról.", null, null))
  34. }).catch(function(e) {
  35. t(new o.CustomError("Nem található megfelelő verziójú Java installáció. Kérlek telepítsd fel a legújabb verziót a 'java.com' weboldalról.", null, null))
  36. })
  37. })
  38. }).then(function() {
  39. var e = {
  40. width: 360,
  41. height: 270,
  42. resizable: !1,
  43. title: "PixelHero",
  44. icon: __dirname + "/favicon.ico"
  45. };
  46. g = new i.BrowserWindow(e), g.setMenu(null), g.loadURL(__dirname + "/frontend/index.html"), g.on("close", function() {
  47. i.app.quit()
  48. }), g.webContents.on("will-navigate", function(e, t) {
  49. e.preventDefault(), i.shell.openExternal(t)
  50. }), "development" == process.env.NODE_ENV && (g.webContents.openDevTools(), i.globalShortcut.register("F5", function() {
  51. g.reload()
  52. }));
  53. new l.MinecraftUpdater
  54. }).catch(function(e) {
  55. s.Utils.showErrorMessage(e, !0), i.app.quit()
  56. }))
  57. });
  58. var E = function() {
  59. h.EventBus.on(p.BackendEvents.LAUNCH_FINISHED, function() {
  60. g.hide()
  61. })
  62. },
  63. v = function() {
  64. i.ipcMain.on(f.IPCMessages.UPDATE_CLIENT_CHECK, function(e) {
  65. i.autoUpdater.addListener("update-not-available", function() {
  66. e.sender.send(f.IPCMessages.UPDATE_CLIENT_NOT_AVAILABLE)
  67. }), i.autoUpdater.addListener("update-available", function() {
  68. e.sender.send(f.IPCMessages.UPDATE_CLIENT_AVAILABLE)
  69. }), i.autoUpdater.addListener("update-downloaded", function(e, t, n, r, s) {
  70. i.autoUpdater.quitAndInstall()
  71. }), i.autoUpdater.addListener("error", function(e) {
  72. s.Utils.showErrorMessage(new o.CustomError("Hiba történt a kliens frissítése közben!", null, e), !0), i.app.quit()
  73. }), (new d.URLs).updateURL().then(function(t) {
  74. i.autoUpdater.setFeedURL(t), "development" != process.env.NODE_ENV ? i.autoUpdater.checkForUpdates() : e.sender.send(f.IPCMessages.UPDATE_CLIENT_NOT_AVAILABLE)
  75. }).catch(function(e) {
  76. s.Utils.showErrorMessage(e, !0), i.app.quit()
  77. })
  78. });
  79. var e, t = new l.MinecraftUpdater;
  80. i.ipcMain.on(f.IPCMessages.UPDATE_MINECRAFT_CHECK, function(n) {
  81. return t.calculateDifferencies().then(function(e) {
  82. return new r(function(t, n) {
  83. return s.Utils.getFreeSpace(s.Utils.getWorkingDirectory()).then(function(r) {
  84. var i = 52428800;
  85. for (var s in e) e[s].remove || (i += e[s].targetFileDetails.size);
  86. i <= r ? t(e) : n(new o.CustomError("Kevés hely! A kliens frissítéséhez további " + (i - r) / 1024 / 1024 + " MB helyre van szükség a fő meghajtón!", null, null))
  87. }).catch(n)
  88. })
  89. }).then(function(t) {
  90. e = t, e.length > 0 ? n.sender.send(f.IPCMessages.UPDATE_MINECRAFT_AVAILABLE) : n.sender.send(f.IPCMessages.UPDATE_MINECRAFT_NOT_AVAILABLE)
  91. }).catch(function(e) {
  92. s.Utils.showErrorMessage(e, !0), i.app.quit()
  93. })
  94. }), i.ipcMain.on(f.IPCMessages.UPDATE_MINECRAFT_START, function(n) {
  95. var r = 0,
  96. o = new c.Progress(function(e) {
  97. e = parseInt(o.getPercentage().toFixed(0)), e != r && (r = e, n.sender.send(f.IPCMessages.UPDATE_MINECRAFT_PROGRESS, r))
  98. });
  99. t.update(e, o).then(function() {
  100. n.sender.send(f.IPCMessages.UPDATE_MINECRAFT_FINISHED)
  101. }).catch(function(e) {
  102. s.Utils.showErrorMessage(e, !0), i.app.quit()
  103. })
  104. });
  105. var n = !1;
  106. i.ipcMain.on(f.IPCMessages.LAUNCH_REQUEST, function(e, t, r, o) {
  107. if (!n) {
  108. var a = new u.MinecraftLauncher(t, r, o);
  109. s.Utils.minecraftLauncher = a, a.launch().catch(function(e) {
  110. s.Utils.showErrorMessage(e, !0), i.app.quit()
  111. }), n = !0
  112. }
  113. }), i.ipcMain.on(f.IPCMessages.LOGIN_REQUEST, function(e, t, n) {
  114. (new d.URLs).apiURL().then(function(e) {
  115. return s.Utils.postRemoteJSON(e, "email=" + t + "&password=" + n)
  116. }).then(function(t) {
  117. t.attempt && ("not_verified" == t.attempt ? e.sender.send(f.IPCMessages.LOGIN_RESPONSE, !0, !1) : e.sender.send(f.IPCMessages.LOGIN_RESPONSE, !1, !0)), t.username && t.sessionID && e.sender.send(f.IPCMessages.LOGIN_RESPONSE, !0, !0, t.username, t.sessionID)
  118. }).catch(function(e) {
  119. s.Utils.showErrorMessage(new o.CustomError("Hiba történt a bejelentkezés közben.", null, e), !0)
  120. })
  121. }), i.ipcMain.on(f.IPCMessages.JAVA_VERSION_REQUEST, function(e) {
  122. s.Utils.getJavaVersion().then(function(t) {
  123. e.sender.send(f.IPCMessages.JAVA_VERSION_RESPONSE, t)
  124. })
  125. }), i.ipcMain.on(f.IPCMessages.MAX_MEMORY_REQUEST, function(e) {
  126. s.Utils.getOptimalMaximumMemory().then(function(t) {
  127. e.sender.send(f.IPCMessages.MAX_MEMORY_RESPONSE, t)
  128. })
  129. }), i.ipcMain.on(f.IPCMessages.REINSTALL_REQUEST, function(e) {
  130. var t = s.Utils.showDialog("Figyelem! Az újratelepítés töröl minden mentett adatot a játékról, beleértve az egyjátékos módban mentett világokat is! Biztosan újra szeretnéd telepíteni a klienst?", !0);
  131. t && "development" != process.env.NODE_ENV && (i.app.relaunch({
  132. args: process.argv.concat(["--remove-app-dir"])
  133. }), i.app.quit())
  134. })
  135. }
  136. }, function(e, t) {
  137. e.exports = require("bluebird")
  138. }, function(e, t) {
  139. e.exports = require("electron")
  140. }, function(e, t, n) {
  141. "use strict";
  142. var r = n(4),
  143. i = n(2),
  144. s = n(1),
  145. o = n(5),
  146. a = n(6),
  147. l = n(9),
  148. c = n(10),
  149. u = n(11),
  150. f = n(8),
  151. h = n(12),
  152. p = n(13),
  153. d = function() {
  154. function e() {}
  155. return e.createWorkingDirectory = function() {
  156. this.workingDirectory = "win32" == u.platform() ? f.join(process.env.APPDATA, ".pixelhero") : f.join(u.homedir(), ".pixelhero/"), c.existsSync(this.workingDirectory) || c.mkdirpSync(this.workingDirectory)
  157. }, e.downloadFile = function(e, t, n) {
  158. return new s(function(r, i) {
  159. c.ensureFile(t, function(s) {
  160. return s ? void i(s) : void o(e).on("error", function(e) {
  161. i(e)
  162. }).on("data", function(e) {
  163. n && n.addProgress(e.length)
  164. }).on("end", function() {
  165. r()
  166. }).pipe(c.createWriteStream(t))
  167. })
  168. })
  169. }, e.getFilesInDirectory = function(e) {
  170. var t = this;
  171. return new s(function(n, r) {
  172. var i = new Array,
  173. s = h.walk(e, {});
  174. s.on("file", function(e, n, s) {
  175. var o = new a.GameFile("", f.join(e, n.name));
  176. t.getFileStats(o).then(function() {
  177. i.push(o)
  178. }).then(s).catch(r)
  179. }), s.on("nodeError", function(e, t, n) {
  180. r(t.error)
  181. }), s.on("directoryError", function(e, t, n) {
  182. r(t.error)
  183. }), s.on("end", function() {
  184. n(i)
  185. })
  186. })
  187. }, e.getFileStats = function(t) {
  188. return new s(function(n, r) {
  189. if (e.isHashIgnoredFile(t.path)) c.stat(t.path, function(e, i) {
  190. return e ? void r(e) : (t.size = i.size, void n())
  191. });
  192. else {
  193. t.size = 0;
  194. var i = l.createHash("sha1");
  195. c.createReadStream(t.path).on("error", function(e) {
  196. r(e)
  197. }).on("data", function(e) {
  198. t.size += e.length, i.update(e)
  199. }).on("end", function() {
  200. t.hash = i.digest("hex"), n()
  201. })
  202. }
  203. })
  204. }, e.getFreeSpace = function(e) {
  205. return new s(function(t, n) {
  206. if ("win32" == u.platform()) {
  207. p.exec('dir "' + e + '" /-C', function(e, r, i) {
  208. if (e) return void n(new Error("Disk space process returned with exit code " + e.code + ": \n" + i));
  209. var s = +r.split("\n").filter(function(e) {
  210. return e
  211. }).reverse()[0].split(" ").filter(function(e) {
  212. return e
  213. })[2];
  214. t(s)
  215. })
  216. } else n(new Error("Disk space check is not implemented on this platform."))
  217. })
  218. }, e.getJavaVersion = function(e) {
  219. var t = this;
  220. return new s(function(n, r) {
  221. var i;
  222. switch (e) {
  223. case "64":
  224. i = p.spawn("java", ["-d64", "-version"]);
  225. break;
  226. case "32":
  227. i = p.spawn("java", ["-d32", "-version"]);
  228. break;
  229. default:
  230. return t.getJavaVersion("64").then(n).catch(r)
  231. }
  232. i.on("error", function(e) {
  233. r(e)
  234. });
  235. var s = "";
  236. i.stderr.on("data", function(e) {
  237. s += e
  238. }), i.on("exit", function(i) {
  239. if (0 == i) n(s.split("\n")[0].split('"')[1] + "_" + e);
  240. else {
  241. if ("64" == e) return t.getJavaVersion("32").then(n).catch(r);
  242. r(new Error("Java exited with code " + i))
  243. }
  244. })
  245. })
  246. }, e.getOptimalMaximumMemory = function() {
  247. var e = this;
  248. return new s(function(t, n) {
  249. var r = .9 * u.freemem(),
  250. i = 0;
  251. i = r <= 536870912 ? 512 : r >= 4294967296 ? 4096 : 256 * Math.floor(r / 1048576 / 256), i > 1024 ? e.getJavaVersion().then(function(e) {
  252. t("32" == e.split("_")[2] ? 1024 : i)
  253. }) : t(i)
  254. })
  255. }, e.getRemoteJSON = function(e) {
  256. return new s(function(t, n) {
  257. o(e, {
  258. json: !0
  259. }).then(function(e) {
  260. t(e)
  261. }).catch(function(e) {
  262. n(e)
  263. })
  264. })
  265. }, e.getWorkingDirectory = function() {
  266. return this.workingDirectory
  267. }, e.isHashIgnoredFile = function(e) {
  268. for (var t = ["assets/objects/"], n = 0; n < t.length && ".." == f.relative(f.join(this.getWorkingDirectory(), t[n]), e).substr(0, 2);) n++;
  269. return n < t.length
  270. }, e.isIgnoredFile = function(e) {
  271. for (var t = ["assets/skins/", "config/", "logs/", "local/", "resourcepacks/", "saves/", "screenshots/", "server-resource-packs/", "shaderpacks/", "tmp/", "servers.dat", "options.txt", "optionsof.txt", "optionsshaders.txt", "usercache.json", "usernamecache.json", "servers.dat_tmp"], n = 0; n < t.length && ".." == f.relative(f.join(this.getWorkingDirectory(), t[n]), e).substr(0, 2);) n++;
  272. return n < t.length
  273. }, e.isOnline = function() {
  274. return new s(function(e, t) {
  275. return o("https://gstatic.com/generate_204", {
  276. timeout: 5e3,
  277. resolveWithFullResponse: !0
  278. }).then(function(t) {
  279. e()
  280. }).catch(function(e) {
  281. t(new r.CustomError("A kliens futtatásához internetkapcsolat szükséges!", null, null))
  282. })
  283. })
  284. }, e.postRemoteJSON = function(e, t) {
  285. return new s(function(n, r) {
  286. return o.post(e, {
  287. timeout: 5e3,
  288. headers: {
  289. "Content-Type": "application/x-www-form-urlencoded",
  290. "Content-Length": Buffer.byteLength(t)
  291. },
  292. body: t,
  293. json: !0
  294. }, function(e, t, i) {
  295. return e ? void r(e) : void n(i)
  296. })
  297. })
  298. }, e.removeApplicationDirectory = function() {
  299. c.removeSync(e.getWorkingDirectory())
  300. }, e.removeFile = function(e) {
  301. return new s(function(t, n) {
  302. c.remove(e, function(e) {
  303. return e ? void n(e) : void t()
  304. })
  305. })
  306. }, e.showDialog = function(e, t) {
  307. var n = {
  308. type: "question",
  309. buttons: ["OK", "Mégsem"],
  310. defaultId: 1,
  311. cancelId: 1,
  312. title: "Megerősítés",
  313. message: e,
  314. detail: "",
  315. noLink: !0
  316. };
  317. return t ? 0 == i.dialog.showMessageBox(n) : 0 == i.dialog.showMessageBox(n, function() {})
  318. }, e.showErrorMessage = function(e, t) {
  319. if (!this.isMessageShown) {
  320. this.isMessageShown = !0;
  321. var n = {
  322. type: "error",
  323. buttons: ["OK"],
  324. defaultId: 0,
  325. cancelId: 0,
  326. title: "Hiba",
  327. message: e.message,
  328. detail: ""
  329. };
  330. e.id && (n.detail += "Hibakód: " + e.id), e.id && e.details && (n.detail += "\n"), e.details && (n.detail += "Bővebb információ: " + e.details), t ? i.dialog.showMessageBox(n) : i.dialog.showMessageBox(n, function() {})
  331. }
  332. }, e
  333. }();
  334. t.Utils = d
  335. }, function(e, t) {
  336. "use strict";
  337. var n = function() {
  338. function e(e, t, n) {
  339. this.message = e, this.id = t, this.details = n
  340. }
  341. return e
  342. }();
  343. t.CustomError = n
  344. }, function(e, t) {
  345. e.exports = require("request-promise")
  346. }, function(e, t, n) {
  347. "use strict";
  348. var r = n(7),
  349. i = n(8),
  350. s = function() {
  351. function e(e, t) {
  352. try {
  353. r.parse(e), this.url = e, i.parse(t), this.path = t, this.size = -1, this.hash = "", this.os = ["win32", "darwin", "linux"]
  354. } catch (e) {
  355. throw e
  356. }
  357. }
  358. return e
  359. }();
  360. t.GameFile = s
  361. }, function(e, t) {
  362. e.exports = require("url")
  363. }, function(e, t) {
  364. e.exports = require("path")
  365. }, function(e, t) {
  366. e.exports = require("crypto")
  367. }, function(e, t) {
  368. e.exports = require("fs-extra")
  369. }, function(e, t) {
  370. e.exports = require("os")
  371. }, function(e, t) {
  372. e.exports = require("walk")
  373. }, function(e, t) {
  374. e.exports = require("child_process")
  375. }, function(e, t, n) {
  376. "use strict";
  377. var r = n(15),
  378. i = n(3),
  379. s = n(4),
  380. o = n(2),
  381. a = n(8),
  382. l = n(6),
  383. c = n(1),
  384. u = function() {
  385. function e(e) {
  386. this.allowedFileChanges = new Array, this.rootDirectory = e, this.setupWatcher()
  387. }
  388. return e.prototype.allowFileChange = function(e) {
  389. this.allowedFileChanges.push(e)
  390. }, e.prototype.setupWatcher = function() {
  391. var e = this,
  392. t = {
  393. persistent: !0,
  394. usePolling: !1,
  395. awaitWriteFinish: {
  396. stabilityThreshold: 5e3,
  397. pollInterval: 500
  398. },
  399. ignorePermissionErrors: !0
  400. };
  401. this.watcher = r.watch(this.rootDirectory, t), this.watcher.on("error", function(e) {
  402. i.Utils.showErrorMessage(new s.CustomError("Hiba történt a kliens működése közben! Kérjük vedd fel velünk a kapcsolatot!", 2, e), !0), o.app.quit()
  403. }), this.watcher.on("ready", function() {
  404. e.watcher.on("all", function(t, n) {
  405. return new c(function(r, o) {
  406. if ("addDir" == t || "unlinkDir" == t) return void e.watcher.unwatch(n);
  407. if (!i.Utils.isIgnoredFile(n)) {
  408. for (var c = 0; c < e.allowedFileChanges.length && (null == e.allowedFileChanges[c] || "" != a.relative(e.allowedFileChanges[c].targetFileDetails.path, n));) c++;
  409. var u = new s.CustomError("Engedély nélküli fájlmódosítás történt!", 1, n);
  410. if (c < e.allowedFileChanges.length)
  411. if ("unlink" == t) e.allowedFileChanges[c].remove ? e.allowedFileChanges[c] = null : o(u);
  412. else if (e.allowedFileChanges[c].remove) o(u);
  413. else {
  414. var f = new l.GameFile("", n);
  415. i.Utils.getFileStats(f).then(function() {
  416. var t = i.Utils.isHashIgnoredFile(f.path) && e.allowedFileChanges[c].targetFileDetails.size == f.size || !i.Utils.isHashIgnoredFile(f.path) && e.allowedFileChanges[c].targetFileDetails.hash == f.hash;
  417. t ? e.allowedFileChanges[c] = null : o(u)
  418. })
  419. } else o(u)
  420. }
  421. }).catch(function(e) {
  422. i.Utils.minecraftLauncher && i.Utils.minecraftLauncher.kill(), i.Utils.showErrorMessage(e, !0), o.app.quit()
  423. })
  424. })
  425. })
  426. }, e
  427. }();
  428. t.FileProtector = u
  429. }, function(e, t) {
  430. e.exports = require("chokidar")
  431. }, function(e, t, n) {
  432. "use strict";
  433. var r = n(3),
  434. i = n(8),
  435. s = n(17),
  436. o = n(1),
  437. a = n(11),
  438. l = n(4),
  439. c = n(18),
  440. u = function() {
  441. function e() {}
  442. return e.prototype.calculateDifferencies = function() {
  443. return new o(function(e, t) {
  444. return (new c.URLs).minecraftVersionURL().then(r.Utils.getRemoteJSON).then(function(t) {
  445. for (var n = t.files, o = 0; o < n.length; o++) n[o].os.indexOf(a.platform()) < 0 ? (n.splice(o, 1), o--) : n[o].path = i.join(r.Utils.getWorkingDirectory(), n[o].path);
  446. return r.Utils.getFilesInDirectory(r.Utils.getWorkingDirectory()).then(function(t) {
  447. var o = new Array;
  448. for (var a in t)
  449. if (r.Utils.isIgnoredFile(t[a].path))
  450. for (var l = 0; l < n.length; l++) n[l].path == t[a].path && (n.splice(l, 1), l--);
  451. else {
  452. for (var l = 0; l < n.length && "" != i.relative(t[a].path, n[l].path);) l++;
  453. if (l < n.length) {
  454. var c = r.Utils.isHashIgnoredFile(t[a].path) && n[l].size == t[a].size || !r.Utils.isHashIgnoredFile(t[a].path) && n[l].hash == t[a].hash;
  455. if (c)
  456. for (var u = 0; u < n.length; u++) n[u].path == t[a].path && (n.splice(u, 1), l--);
  457. else o.push(new s.FileChange(n[l], !1))
  458. } else o.push(new s.FileChange(t[a], !0))
  459. } for (var a in n) o.push(new s.FileChange(n[a], !1));
  460. e(o)
  461. })
  462. }).catch(function(e) {
  463. t(new l.CustomError("Hiba történt a kliens frissítése közben! Kérjük vedd fel velünk a kapcsolatot!", 101, e))
  464. })
  465. })
  466. }, e.prototype.downloadFile = function(e, t) {
  467. return new o(function(n, i) {
  468. r.Utils.fileProtector.allowFileChange(e), r.Utils.downloadFile(e.targetFileDetails.url, e.targetFileDetails.path, t).then(n).catch(i)
  469. })
  470. }, e.prototype.removeFile = function(e) {
  471. return new o(function(t, n) {
  472. r.Utils.fileProtector.allowFileChange(e), r.Utils.removeFile(e.targetFileDetails.path).then(t).catch(n)
  473. })
  474. }, e.prototype.update = function(e, t) {
  475. var n = this;
  476. return new o(function(r, i) {
  477. for (var s in e) t && (t.maximumValue += e[s].targetFileDetails.size);
  478. o.mapSeries(e, function(e) {
  479. return e.remove ? n.removeFile(e) : n.downloadFile(e, t)
  480. }).then(function() {
  481. r()
  482. }).catch(function(e) {
  483. e.statusCode && 499 == e.statusCode && (e = "Egy vagy több fájl letöltését valószínűleg a vírusírtód reklámcsíkblokkoló funkciója blokkolhatja. Kérjük, hogy kapcsold ki a vírusírtód reklámcsíkblokkoló funckióját a további problémák elkerülése végett."), i(new l.CustomError("Hiba történt a kliens frissítése közben! Kérjük vedd fel velünk a kapcsolatot!", 102, e))
  484. })
  485. })
  486. }, e
  487. }();
  488. t.MinecraftUpdater = u
  489. }, function(e, t) {
  490. "use strict";
  491. var n = function() {
  492. function e(e, t) {
  493. this.targetFileDetails = e, this.remove = t
  494. }
  495. return e
  496. }();
  497. t.FileChange = n
  498. }, function(e, t, n) {
  499. "use strict";
  500. var r = this && this.__awaiter || function(e, t, n, r) {
  501. return new(n || (n = Promise))(function(i, s) {
  502. function o(e) {
  503. try {
  504. l(r.next(e))
  505. } catch (e) {
  506. s(e)
  507. }
  508. }
  509.  
  510. function a(e) {
  511. try {
  512. l(r.throw(e))
  513. } catch (e) {
  514. s(e)
  515. }
  516. }
  517.  
  518. function l(e) {
  519. e.done ? i(e.value) : new n(function(t) {
  520. t(e.value)
  521. }).then(o, a)
  522. }
  523. l((r = r.apply(e, t || [])).next())
  524. })
  525. },
  526. i = this && this.__generator || function(e, t) {
  527. function n(e) {
  528. return function(t) {
  529. return r([e, t])
  530. }
  531. }
  532.  
  533. function r(n) {
  534. if (i) throw new TypeError("Generator is already executing.");
  535. for (; a;) try {
  536. if (i = 1, s && (o = s[2 & n[0] ? "return" : n[0] ? "throw" : "next"]) && !(o = o.call(s, n[1])).done) return o;
  537. switch (s = 0, o && (n = [0, o.value]), n[0]) {
  538. case 0:
  539. case 1:
  540. o = n;
  541. break;
  542. case 4:
  543. return a.label++, {
  544. value: n[1],
  545. done: !1
  546. };
  547. case 5:
  548. a.label++, s = n[1], n = [0];
  549. continue;
  550. case 7:
  551. n = a.ops.pop(), a.trys.pop();
  552. continue;
  553. default:
  554. if (o = a.trys, !(o = o.length > 0 && o[o.length - 1]) && (6 === n[0] || 2 === n[0])) {
  555. a = 0;
  556. continue
  557. }
  558. if (3 === n[0] && (!o || n[1] > o[0] && n[1] < o[3])) {
  559. a.label = n[1];
  560. break
  561. }
  562. if (6 === n[0] && a.label < o[1]) {
  563. a.label = o[1], o = n;
  564. break
  565. }
  566. if (o && a.label < o[2]) {
  567. a.label = o[2], a.ops.push(n);
  568. break
  569. }
  570. o[2] && a.ops.pop(), a.trys.pop();
  571. continue
  572. }
  573. n = t.call(e, a)
  574. } catch (e) {
  575. n = [6, e], s = 0
  576. } finally {
  577. i = o = 0
  578. }
  579. if (5 & n[0]) throw n[1];
  580. return {
  581. value: n[0] ? n[1] : void 0,
  582. done: !0
  583. }
  584. }
  585. var i, s, o, a = {
  586. label: 0,
  587. sent: function() {
  588. if (1 & o[0]) throw o[1];
  589. return o[1]
  590. },
  591. trys: [],
  592. ops: []
  593. };
  594. return {
  595. next: n(0),
  596. throw: n(1),
  597. return: n(2)
  598. }
  599. },
  600. s = n(4),
  601. o = n(3),
  602. a = function() {
  603. function e() {}
  604. return e.prototype.fetchURLs = function() {
  605. return r(this, void 0, void 0, function() {
  606. var t, n;
  607. return i(this, function(r) {
  608. switch (r.label) {
  609. case 0:
  610. if ("" != e.apiURL && !e.minecraftVersionURL && "" != e.updateURL) return [3, 4];
  611. r.label = 1;
  612. case 1:
  613. return r.trys.push([1, 3, , 4]), [4, o.Utils.getRemoteJSON("https://pixelhero.s3.amazonaws.com/client/urls.json")];
  614. case 2:
  615. return t = r.sent(), e.apiURL = t.apiURL, e.minecraftVersionURL = t.minecraftVersionURL, e.updateURL = t.updateURL, [3, 4];
  616. case 3:
  617. throw n = r.sent(), new s.CustomError("Nem sikerült frissíteni az URL listát.", 401, n);
  618. case 4:
  619. return [2]
  620. }
  621. })
  622. })
  623. }, e.prototype.apiURL = function() {
  624. return r(this, void 0, void 0, function() {
  625. return i(this, function(t) {
  626. switch (t.label) {
  627. case 0:
  628. return [4, this.fetchURLs()];
  629. case 1:
  630. return t.sent(), [2, e.apiURL]
  631. }
  632. })
  633. })
  634. }, e.prototype.minecraftVersionURL = function() {
  635. return r(this, void 0, void 0, function() {
  636. return i(this, function(t) {
  637. switch (t.label) {
  638. case 0:
  639. return [4, this.fetchURLs()];
  640. case 1:
  641. return t.sent(), [2, e.minecraftVersionURL]
  642. }
  643. })
  644. })
  645. }, e.prototype.updateURL = function() {
  646. return r(this, void 0, void 0, function() {
  647. return i(this, function(t) {
  648. switch (t.label) {
  649. case 0:
  650. return [4, this.fetchURLs()];
  651. case 1:
  652. return t.sent(), [2, e.updateURL]
  653. }
  654. })
  655. })
  656. }, e
  657. }();
  658. a.apiURL = "", a.minecraftVersionURL = "", a.updateURL = "", t.URLs = a
  659. }, function(e, t) {
  660. "use strict";
  661. var n = function() {
  662. function e(e) {
  663. this.progress = 0, this.maximumValue = 0, this.progressCallback = e
  664. }
  665. return e.prototype.addProgress = function(e) {
  666. this.progress += e, this.progressCallback(this.progress)
  667. }, e.prototype.getPercentage = function() {
  668. return this.progress / this.maximumValue * 100
  669. }, e
  670. }();
  671. t.Progress = n
  672. }, function(e, t, n) {
  673. "use strict";
  674. var r = n(3),
  675. i = n(8),
  676. s = n(13),
  677. o = n(4),
  678. a = n(2),
  679. l = n(10),
  680. c = n(21),
  681. u = n(23),
  682. f = n(1),
  683. h = n(18),
  684. p = function() {
  685. function e(e, t, n) {
  686. this.memory = e, this.username = t, this.sessionID = n, this.additionalArgs = ""
  687. }
  688. return e.prototype.launch = function() {
  689. var e = this;
  690. return new f(function(t, n) {
  691. var p = "",
  692. d = "";
  693. (new h.URLs).minecraftVersionURL().then(r.Utils.getRemoteJSON).then(function(t) {
  694. d = t.mainClass, e.additionalArgs = t.minecraftArguments, e.additionalArgs = e.additionalArgs.replace("${auth_player_name}", e.username), e.additionalArgs = e.additionalArgs.replace("${version_name}", t.id), e.additionalArgs = e.additionalArgs.replace("${game_directory}", "."), e.additionalArgs = e.additionalArgs.replace("${assets_root}", "assets"), e.additionalArgs = e.additionalArgs.replace("${assets_index_name}", t.assetIndex), e.additionalArgs = e.additionalArgs.replace("${auth_uuid}", "${auth_uuid}"), e.additionalArgs = e.additionalArgs.replace("${auth_access_token}", e.sessionID), e.additionalArgs = e.additionalArgs.replace("${user_type}", "${user_type}"), e.additionalArgs = e.additionalArgs.replace("${version_type}", "PixelHero")
  695. }).catch(function(e) {
  696. n(new o.CustomError("Hiba történt a kliens indítása közben!", 201, e))
  697. }).then(function() {
  698. return r.Utils.getFilesInDirectory(i.join(r.Utils.getWorkingDirectory(), "libraries"))
  699. }).then(function(t) {
  700. return new f(function(n, f) {
  701. for (var h in t) p += "win32" == process.platform ? t[h].path + ";" : t[h].path + ":";
  702. p += i.join(r.Utils.getWorkingDirectory(), "minecraft.jar");
  703. var g = new Array;
  704. g.push("-Djava.library.path=" + i.join(r.Utils.getWorkingDirectory(), "natives")), g.push("-Xms512M"), g.push("-Xmx" + e.memory + "M"), g.push("-cp"), g.push(p), g.push(d), g = g.concat(e.additionalArgs.split(" ")), e.process = s.spawn("java", g, {
  705. cwd: r.Utils.getWorkingDirectory(),
  706. detached: !1
  707. }), e.process.on("error", function(e) {
  708. f(new o.CustomError("Hiba történt a kliens indítása közben!", 202, e.message))
  709. });
  710. var E = !1;
  711. e.process.stdout.on("data", function(e) {
  712. e.toString().indexOf("[OptiFine]") > 0 && !E && (E = !0, c.EventBus.emit(u.BackendEvents.LAUNCH_FINISHED)), "Error occurred during initialization of VM\nCould not reserve enough space for object heap\n" == e.toString() && f(new o.CustomError("Nincs elég szabad memória!", null, "A játék futtatásához legalább 512 MB szabad memóriára van szükség. Amennyiben egyedi maximális memória szintet használsz, kérjük ellenőrizd, hogy a megadott értéknek megfelelően van-e elég szabad memóriád."))
  713. }), l.ensureFileSync(i.join(r.Utils.getWorkingDirectory(), "logs", "pixelhero.log"));
  714. var v = l.createWriteStream(i.join(r.Utils.getWorkingDirectory(), "logs", "pixelhero.log"));
  715. e.process.stderr.pipe(v), e.process.stdout.pipe(v), e.process.on("exit", function(e) {
  716. 0 == e ? (a.app.quit(), n()) : f(new o.CustomError("Nem várt leállási kód!", 203, "Leállási kód: " + e))
  717. })
  718. })
  719. }).catch(n)
  720. })
  721. }, e.prototype.kill = function() {
  722. this.process && this.process.kill()
  723. }, e
  724. }();
  725. t.MinecraftLauncher = p
  726. }, function(e, t, n) {
  727. "use strict";
  728. var r = this && this.__extends || function(e, t) {
  729. function n() {
  730. this.constructor = e
  731. }
  732. for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]);
  733. e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, new n)
  734. },
  735. i = n(22),
  736. s = function(e) {
  737. function t() {
  738. return null !== e && e.apply(this, arguments) || this
  739. }
  740. return r(t, e), t
  741. }(i.EventEmitter);
  742. t.EventBus = new s, t.EventBus.setMaxListeners(0)
  743. }, function(e, t) {
  744. e.exports = require("events")
  745. }, function(e, t) {
  746. "use strict";
  747. var n = function() {
  748. function e() {}
  749. return e
  750. }();
  751. n.LAUNCH_FINISHED = "LAUNCH_FINISHED", t.BackendEvents = n
  752. }, function(e, t) {
  753. "use strict";
  754. var n = function() {
  755. function e() {}
  756. return e
  757. }();
  758. n.JAVA_VERSION_REQUEST = "JAVA_VERSION_REQUEST", n.JAVA_VERSION_RESPONSE = "JAVA_VERSION_RESPONSE", n.LAUNCH_REQUEST = "LAUNCH_REQUEST", n.LOGIN_REQUEST = "LOGIN_REQUEST", n.LOGIN_RESPONSE = "LOGIN_RESPONSE", n.MAX_MEMORY_REQUEST = "MAX_MEMORY_REQUEST", n.MAX_MEMORY_RESPONSE = "MAX_MEMORY_RESPONSE", n.REINSTALL_REQUEST = "REINSTALL_REQUEST", n.UPDATE_CLIENT_AVAILABLE = "UPDATE_CLIENT_AVAILABLE", n.UPDATE_CLIENT_CHECK = "UPDATE_CLIENT_CHECK", n.UPDATE_CLIENT_NOT_AVAILABLE = "UPDATE_CLIENT_NOT_AVAILABLE", n.UPDATE_MINECRAFT_AVAILABLE = "UPDATE_MINECRAFT_AVAILABLE", n.UPDATE_MINECRAFT_CHECK = "UPDATE_MINECRAFT_CHECK", n.UPDATE_MINECRAFT_FINISHED = "UPDATE_MINECRAFT_FINISHED", n.UPDATE_MINECRAFT_NOT_AVAILABLE = "UPDATE_MINECRAFT_NOT_AVAILABLE", n.UPDATE_MINECRAFT_START = "UPDATE_MINECRAFT_START", n.UPDATE_MINECRAFT_PROGRESS = "UPDATE_MINECRAFT_PROGRESS", t.IPCMessages = n
  759. }, function(e, t) {
  760. e.exports = require("electron-squirrel-startup")
  761. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement