Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! function(e) {
- function t(r) {
- if (n[r]) return n[r].exports;
- var i = n[r] = {
- exports: {},
- id: r,
- loaded: !1
- };
- return e[r].call(i.exports, i, i.exports, t), i.loaded = !0, i.exports
- }
- var n = {};
- return t.m = e, t.c = n, t.p = "", t(0)
- }([function(e, t, n) {
- "use strict";
- var r = n(1),
- i = n(2),
- s = n(3),
- o = n(4),
- a = n(14),
- l = n(16),
- c = n(19),
- u = n(20),
- f = n(24),
- h = n(21),
- p = n(23),
- d = n(18);
- s.Utils.createWorkingDirectory(), process.argv.indexOf("--remove-app-dir") != -1 && (s.Utils.removeApplicationDirectory(), s.Utils.createWorkingDirectory()), n(25) && i.app.quit();
- var g;
- i.app.on("ready", function() {
- 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() {
- return new r(function(e, t) {
- return s.Utils.getJavaVersion().then(function(n) {
- 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))
- }).catch(function(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))
- })
- })
- }).then(function() {
- var e = {
- width: 360,
- height: 270,
- resizable: !1,
- title: "PixelHero",
- icon: __dirname + "/favicon.ico"
- };
- g = new i.BrowserWindow(e), g.setMenu(null), g.loadURL(__dirname + "/frontend/index.html"), g.on("close", function() {
- i.app.quit()
- }), g.webContents.on("will-navigate", function(e, t) {
- e.preventDefault(), i.shell.openExternal(t)
- }), "development" == process.env.NODE_ENV && (g.webContents.openDevTools(), i.globalShortcut.register("F5", function() {
- g.reload()
- }));
- new l.MinecraftUpdater
- }).catch(function(e) {
- s.Utils.showErrorMessage(e, !0), i.app.quit()
- }))
- });
- var E = function() {
- h.EventBus.on(p.BackendEvents.LAUNCH_FINISHED, function() {
- g.hide()
- })
- },
- v = function() {
- i.ipcMain.on(f.IPCMessages.UPDATE_CLIENT_CHECK, function(e) {
- i.autoUpdater.addListener("update-not-available", function() {
- e.sender.send(f.IPCMessages.UPDATE_CLIENT_NOT_AVAILABLE)
- }), i.autoUpdater.addListener("update-available", function() {
- e.sender.send(f.IPCMessages.UPDATE_CLIENT_AVAILABLE)
- }), i.autoUpdater.addListener("update-downloaded", function(e, t, n, r, s) {
- i.autoUpdater.quitAndInstall()
- }), i.autoUpdater.addListener("error", function(e) {
- s.Utils.showErrorMessage(new o.CustomError("Hiba történt a kliens frissítése közben!", null, e), !0), i.app.quit()
- }), (new d.URLs).updateURL().then(function(t) {
- i.autoUpdater.setFeedURL(t), "development" != process.env.NODE_ENV ? i.autoUpdater.checkForUpdates() : e.sender.send(f.IPCMessages.UPDATE_CLIENT_NOT_AVAILABLE)
- }).catch(function(e) {
- s.Utils.showErrorMessage(e, !0), i.app.quit()
- })
- });
- var e, t = new l.MinecraftUpdater;
- i.ipcMain.on(f.IPCMessages.UPDATE_MINECRAFT_CHECK, function(n) {
- return t.calculateDifferencies().then(function(e) {
- return new r(function(t, n) {
- return s.Utils.getFreeSpace(s.Utils.getWorkingDirectory()).then(function(r) {
- var i = 52428800;
- for (var s in e) e[s].remove || (i += e[s].targetFileDetails.size);
- 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))
- }).catch(n)
- })
- }).then(function(t) {
- e = t, e.length > 0 ? n.sender.send(f.IPCMessages.UPDATE_MINECRAFT_AVAILABLE) : n.sender.send(f.IPCMessages.UPDATE_MINECRAFT_NOT_AVAILABLE)
- }).catch(function(e) {
- s.Utils.showErrorMessage(e, !0), i.app.quit()
- })
- }), i.ipcMain.on(f.IPCMessages.UPDATE_MINECRAFT_START, function(n) {
- var r = 0,
- o = new c.Progress(function(e) {
- e = parseInt(o.getPercentage().toFixed(0)), e != r && (r = e, n.sender.send(f.IPCMessages.UPDATE_MINECRAFT_PROGRESS, r))
- });
- t.update(e, o).then(function() {
- n.sender.send(f.IPCMessages.UPDATE_MINECRAFT_FINISHED)
- }).catch(function(e) {
- s.Utils.showErrorMessage(e, !0), i.app.quit()
- })
- });
- var n = !1;
- i.ipcMain.on(f.IPCMessages.LAUNCH_REQUEST, function(e, t, r, o) {
- if (!n) {
- var a = new u.MinecraftLauncher(t, r, o);
- s.Utils.minecraftLauncher = a, a.launch().catch(function(e) {
- s.Utils.showErrorMessage(e, !0), i.app.quit()
- }), n = !0
- }
- }), i.ipcMain.on(f.IPCMessages.LOGIN_REQUEST, function(e, t, n) {
- (new d.URLs).apiURL().then(function(e) {
- return s.Utils.postRemoteJSON(e, "email=" + t + "&password=" + n)
- }).then(function(t) {
- 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)
- }).catch(function(e) {
- s.Utils.showErrorMessage(new o.CustomError("Hiba történt a bejelentkezés közben.", null, e), !0)
- })
- }), i.ipcMain.on(f.IPCMessages.JAVA_VERSION_REQUEST, function(e) {
- s.Utils.getJavaVersion().then(function(t) {
- e.sender.send(f.IPCMessages.JAVA_VERSION_RESPONSE, t)
- })
- }), i.ipcMain.on(f.IPCMessages.MAX_MEMORY_REQUEST, function(e) {
- s.Utils.getOptimalMaximumMemory().then(function(t) {
- e.sender.send(f.IPCMessages.MAX_MEMORY_RESPONSE, t)
- })
- }), i.ipcMain.on(f.IPCMessages.REINSTALL_REQUEST, function(e) {
- 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);
- t && "development" != process.env.NODE_ENV && (i.app.relaunch({
- args: process.argv.concat(["--remove-app-dir"])
- }), i.app.quit())
- })
- }
- }, function(e, t) {
- e.exports = require("bluebird")
- }, function(e, t) {
- e.exports = require("electron")
- }, function(e, t, n) {
- "use strict";
- var r = n(4),
- i = n(2),
- s = n(1),
- o = n(5),
- a = n(6),
- l = n(9),
- c = n(10),
- u = n(11),
- f = n(8),
- h = n(12),
- p = n(13),
- d = function() {
- function e() {}
- return e.createWorkingDirectory = function() {
- this.workingDirectory = "win32" == u.platform() ? f.join(process.env.APPDATA, ".pixelhero") : f.join(u.homedir(), ".pixelhero/"), c.existsSync(this.workingDirectory) || c.mkdirpSync(this.workingDirectory)
- }, e.downloadFile = function(e, t, n) {
- return new s(function(r, i) {
- c.ensureFile(t, function(s) {
- return s ? void i(s) : void o(e).on("error", function(e) {
- i(e)
- }).on("data", function(e) {
- n && n.addProgress(e.length)
- }).on("end", function() {
- r()
- }).pipe(c.createWriteStream(t))
- })
- })
- }, e.getFilesInDirectory = function(e) {
- var t = this;
- return new s(function(n, r) {
- var i = new Array,
- s = h.walk(e, {});
- s.on("file", function(e, n, s) {
- var o = new a.GameFile("", f.join(e, n.name));
- t.getFileStats(o).then(function() {
- i.push(o)
- }).then(s).catch(r)
- }), s.on("nodeError", function(e, t, n) {
- r(t.error)
- }), s.on("directoryError", function(e, t, n) {
- r(t.error)
- }), s.on("end", function() {
- n(i)
- })
- })
- }, e.getFileStats = function(t) {
- return new s(function(n, r) {
- if (e.isHashIgnoredFile(t.path)) c.stat(t.path, function(e, i) {
- return e ? void r(e) : (t.size = i.size, void n())
- });
- else {
- t.size = 0;
- var i = l.createHash("sha1");
- c.createReadStream(t.path).on("error", function(e) {
- r(e)
- }).on("data", function(e) {
- t.size += e.length, i.update(e)
- }).on("end", function() {
- t.hash = i.digest("hex"), n()
- })
- }
- })
- }, e.getFreeSpace = function(e) {
- return new s(function(t, n) {
- if ("win32" == u.platform()) {
- p.exec('dir "' + e + '" /-C', function(e, r, i) {
- if (e) return void n(new Error("Disk space process returned with exit code " + e.code + ": \n" + i));
- var s = +r.split("\n").filter(function(e) {
- return e
- }).reverse()[0].split(" ").filter(function(e) {
- return e
- })[2];
- t(s)
- })
- } else n(new Error("Disk space check is not implemented on this platform."))
- })
- }, e.getJavaVersion = function(e) {
- var t = this;
- return new s(function(n, r) {
- var i;
- switch (e) {
- case "64":
- i = p.spawn("java", ["-d64", "-version"]);
- break;
- case "32":
- i = p.spawn("java", ["-d32", "-version"]);
- break;
- default:
- return t.getJavaVersion("64").then(n).catch(r)
- }
- i.on("error", function(e) {
- r(e)
- });
- var s = "";
- i.stderr.on("data", function(e) {
- s += e
- }), i.on("exit", function(i) {
- if (0 == i) n(s.split("\n")[0].split('"')[1] + "_" + e);
- else {
- if ("64" == e) return t.getJavaVersion("32").then(n).catch(r);
- r(new Error("Java exited with code " + i))
- }
- })
- })
- }, e.getOptimalMaximumMemory = function() {
- var e = this;
- return new s(function(t, n) {
- var r = .9 * u.freemem(),
- i = 0;
- i = r <= 536870912 ? 512 : r >= 4294967296 ? 4096 : 256 * Math.floor(r / 1048576 / 256), i > 1024 ? e.getJavaVersion().then(function(e) {
- t("32" == e.split("_")[2] ? 1024 : i)
- }) : t(i)
- })
- }, e.getRemoteJSON = function(e) {
- return new s(function(t, n) {
- o(e, {
- json: !0
- }).then(function(e) {
- t(e)
- }).catch(function(e) {
- n(e)
- })
- })
- }, e.getWorkingDirectory = function() {
- return this.workingDirectory
- }, e.isHashIgnoredFile = function(e) {
- for (var t = ["assets/objects/"], n = 0; n < t.length && ".." == f.relative(f.join(this.getWorkingDirectory(), t[n]), e).substr(0, 2);) n++;
- return n < t.length
- }, e.isIgnoredFile = function(e) {
- 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++;
- return n < t.length
- }, e.isOnline = function() {
- return new s(function(e, t) {
- return o("https://gstatic.com/generate_204", {
- timeout: 5e3,
- resolveWithFullResponse: !0
- }).then(function(t) {
- e()
- }).catch(function(e) {
- t(new r.CustomError("A kliens futtatásához internetkapcsolat szükséges!", null, null))
- })
- })
- }, e.postRemoteJSON = function(e, t) {
- return new s(function(n, r) {
- return o.post(e, {
- timeout: 5e3,
- headers: {
- "Content-Type": "application/x-www-form-urlencoded",
- "Content-Length": Buffer.byteLength(t)
- },
- body: t,
- json: !0
- }, function(e, t, i) {
- return e ? void r(e) : void n(i)
- })
- })
- }, e.removeApplicationDirectory = function() {
- c.removeSync(e.getWorkingDirectory())
- }, e.removeFile = function(e) {
- return new s(function(t, n) {
- c.remove(e, function(e) {
- return e ? void n(e) : void t()
- })
- })
- }, e.showDialog = function(e, t) {
- var n = {
- type: "question",
- buttons: ["OK", "Mégsem"],
- defaultId: 1,
- cancelId: 1,
- title: "Megerősítés",
- message: e,
- detail: "",
- noLink: !0
- };
- return t ? 0 == i.dialog.showMessageBox(n) : 0 == i.dialog.showMessageBox(n, function() {})
- }, e.showErrorMessage = function(e, t) {
- if (!this.isMessageShown) {
- this.isMessageShown = !0;
- var n = {
- type: "error",
- buttons: ["OK"],
- defaultId: 0,
- cancelId: 0,
- title: "Hiba",
- message: e.message,
- detail: ""
- };
- 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() {})
- }
- }, e
- }();
- t.Utils = d
- }, function(e, t) {
- "use strict";
- var n = function() {
- function e(e, t, n) {
- this.message = e, this.id = t, this.details = n
- }
- return e
- }();
- t.CustomError = n
- }, function(e, t) {
- e.exports = require("request-promise")
- }, function(e, t, n) {
- "use strict";
- var r = n(7),
- i = n(8),
- s = function() {
- function e(e, t) {
- try {
- r.parse(e), this.url = e, i.parse(t), this.path = t, this.size = -1, this.hash = "", this.os = ["win32", "darwin", "linux"]
- } catch (e) {
- throw e
- }
- }
- return e
- }();
- t.GameFile = s
- }, function(e, t) {
- e.exports = require("url")
- }, function(e, t) {
- e.exports = require("path")
- }, function(e, t) {
- e.exports = require("crypto")
- }, function(e, t) {
- e.exports = require("fs-extra")
- }, function(e, t) {
- e.exports = require("os")
- }, function(e, t) {
- e.exports = require("walk")
- }, function(e, t) {
- e.exports = require("child_process")
- }, function(e, t, n) {
- "use strict";
- var r = n(15),
- i = n(3),
- s = n(4),
- o = n(2),
- a = n(8),
- l = n(6),
- c = n(1),
- u = function() {
- function e(e) {
- this.allowedFileChanges = new Array, this.rootDirectory = e, this.setupWatcher()
- }
- return e.prototype.allowFileChange = function(e) {
- this.allowedFileChanges.push(e)
- }, e.prototype.setupWatcher = function() {
- var e = this,
- t = {
- persistent: !0,
- usePolling: !1,
- awaitWriteFinish: {
- stabilityThreshold: 5e3,
- pollInterval: 500
- },
- ignorePermissionErrors: !0
- };
- this.watcher = r.watch(this.rootDirectory, t), this.watcher.on("error", function(e) {
- 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()
- }), this.watcher.on("ready", function() {
- e.watcher.on("all", function(t, n) {
- return new c(function(r, o) {
- if ("addDir" == t || "unlinkDir" == t) return void e.watcher.unwatch(n);
- if (!i.Utils.isIgnoredFile(n)) {
- for (var c = 0; c < e.allowedFileChanges.length && (null == e.allowedFileChanges[c] || "" != a.relative(e.allowedFileChanges[c].targetFileDetails.path, n));) c++;
- var u = new s.CustomError("Engedély nélküli fájlmódosítás történt!", 1, n);
- if (c < e.allowedFileChanges.length)
- if ("unlink" == t) e.allowedFileChanges[c].remove ? e.allowedFileChanges[c] = null : o(u);
- else if (e.allowedFileChanges[c].remove) o(u);
- else {
- var f = new l.GameFile("", n);
- i.Utils.getFileStats(f).then(function() {
- 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;
- t ? e.allowedFileChanges[c] = null : o(u)
- })
- } else o(u)
- }
- }).catch(function(e) {
- i.Utils.minecraftLauncher && i.Utils.minecraftLauncher.kill(), i.Utils.showErrorMessage(e, !0), o.app.quit()
- })
- })
- })
- }, e
- }();
- t.FileProtector = u
- }, function(e, t) {
- e.exports = require("chokidar")
- }, function(e, t, n) {
- "use strict";
- var r = n(3),
- i = n(8),
- s = n(17),
- o = n(1),
- a = n(11),
- l = n(4),
- c = n(18),
- u = function() {
- function e() {}
- return e.prototype.calculateDifferencies = function() {
- return new o(function(e, t) {
- return (new c.URLs).minecraftVersionURL().then(r.Utils.getRemoteJSON).then(function(t) {
- 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);
- return r.Utils.getFilesInDirectory(r.Utils.getWorkingDirectory()).then(function(t) {
- var o = new Array;
- for (var a in t)
- if (r.Utils.isIgnoredFile(t[a].path))
- for (var l = 0; l < n.length; l++) n[l].path == t[a].path && (n.splice(l, 1), l--);
- else {
- for (var l = 0; l < n.length && "" != i.relative(t[a].path, n[l].path);) l++;
- if (l < n.length) {
- 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;
- if (c)
- for (var u = 0; u < n.length; u++) n[u].path == t[a].path && (n.splice(u, 1), l--);
- else o.push(new s.FileChange(n[l], !1))
- } else o.push(new s.FileChange(t[a], !0))
- } for (var a in n) o.push(new s.FileChange(n[a], !1));
- e(o)
- })
- }).catch(function(e) {
- 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))
- })
- })
- }, e.prototype.downloadFile = function(e, t) {
- return new o(function(n, i) {
- r.Utils.fileProtector.allowFileChange(e), r.Utils.downloadFile(e.targetFileDetails.url, e.targetFileDetails.path, t).then(n).catch(i)
- })
- }, e.prototype.removeFile = function(e) {
- return new o(function(t, n) {
- r.Utils.fileProtector.allowFileChange(e), r.Utils.removeFile(e.targetFileDetails.path).then(t).catch(n)
- })
- }, e.prototype.update = function(e, t) {
- var n = this;
- return new o(function(r, i) {
- for (var s in e) t && (t.maximumValue += e[s].targetFileDetails.size);
- o.mapSeries(e, function(e) {
- return e.remove ? n.removeFile(e) : n.downloadFile(e, t)
- }).then(function() {
- r()
- }).catch(function(e) {
- 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))
- })
- })
- }, e
- }();
- t.MinecraftUpdater = u
- }, function(e, t) {
- "use strict";
- var n = function() {
- function e(e, t) {
- this.targetFileDetails = e, this.remove = t
- }
- return e
- }();
- t.FileChange = n
- }, function(e, t, n) {
- "use strict";
- var r = this && this.__awaiter || function(e, t, n, r) {
- return new(n || (n = Promise))(function(i, s) {
- function o(e) {
- try {
- l(r.next(e))
- } catch (e) {
- s(e)
- }
- }
- function a(e) {
- try {
- l(r.throw(e))
- } catch (e) {
- s(e)
- }
- }
- function l(e) {
- e.done ? i(e.value) : new n(function(t) {
- t(e.value)
- }).then(o, a)
- }
- l((r = r.apply(e, t || [])).next())
- })
- },
- i = this && this.__generator || function(e, t) {
- function n(e) {
- return function(t) {
- return r([e, t])
- }
- }
- function r(n) {
- if (i) throw new TypeError("Generator is already executing.");
- for (; a;) try {
- if (i = 1, s && (o = s[2 & n[0] ? "return" : n[0] ? "throw" : "next"]) && !(o = o.call(s, n[1])).done) return o;
- switch (s = 0, o && (n = [0, o.value]), n[0]) {
- case 0:
- case 1:
- o = n;
- break;
- case 4:
- return a.label++, {
- value: n[1],
- done: !1
- };
- case 5:
- a.label++, s = n[1], n = [0];
- continue;
- case 7:
- n = a.ops.pop(), a.trys.pop();
- continue;
- default:
- if (o = a.trys, !(o = o.length > 0 && o[o.length - 1]) && (6 === n[0] || 2 === n[0])) {
- a = 0;
- continue
- }
- if (3 === n[0] && (!o || n[1] > o[0] && n[1] < o[3])) {
- a.label = n[1];
- break
- }
- if (6 === n[0] && a.label < o[1]) {
- a.label = o[1], o = n;
- break
- }
- if (o && a.label < o[2]) {
- a.label = o[2], a.ops.push(n);
- break
- }
- o[2] && a.ops.pop(), a.trys.pop();
- continue
- }
- n = t.call(e, a)
- } catch (e) {
- n = [6, e], s = 0
- } finally {
- i = o = 0
- }
- if (5 & n[0]) throw n[1];
- return {
- value: n[0] ? n[1] : void 0,
- done: !0
- }
- }
- var i, s, o, a = {
- label: 0,
- sent: function() {
- if (1 & o[0]) throw o[1];
- return o[1]
- },
- trys: [],
- ops: []
- };
- return {
- next: n(0),
- throw: n(1),
- return: n(2)
- }
- },
- s = n(4),
- o = n(3),
- a = function() {
- function e() {}
- return e.prototype.fetchURLs = function() {
- return r(this, void 0, void 0, function() {
- var t, n;
- return i(this, function(r) {
- switch (r.label) {
- case 0:
- if ("" != e.apiURL && !e.minecraftVersionURL && "" != e.updateURL) return [3, 4];
- r.label = 1;
- case 1:
- return r.trys.push([1, 3, , 4]), [4, o.Utils.getRemoteJSON("https://pixelhero.s3.amazonaws.com/client/urls.json")];
- case 2:
- return t = r.sent(), e.apiURL = t.apiURL, e.minecraftVersionURL = t.minecraftVersionURL, e.updateURL = t.updateURL, [3, 4];
- case 3:
- throw n = r.sent(), new s.CustomError("Nem sikerült frissíteni az URL listát.", 401, n);
- case 4:
- return [2]
- }
- })
- })
- }, e.prototype.apiURL = function() {
- return r(this, void 0, void 0, function() {
- return i(this, function(t) {
- switch (t.label) {
- case 0:
- return [4, this.fetchURLs()];
- case 1:
- return t.sent(), [2, e.apiURL]
- }
- })
- })
- }, e.prototype.minecraftVersionURL = function() {
- return r(this, void 0, void 0, function() {
- return i(this, function(t) {
- switch (t.label) {
- case 0:
- return [4, this.fetchURLs()];
- case 1:
- return t.sent(), [2, e.minecraftVersionURL]
- }
- })
- })
- }, e.prototype.updateURL = function() {
- return r(this, void 0, void 0, function() {
- return i(this, function(t) {
- switch (t.label) {
- case 0:
- return [4, this.fetchURLs()];
- case 1:
- return t.sent(), [2, e.updateURL]
- }
- })
- })
- }, e
- }();
- a.apiURL = "", a.minecraftVersionURL = "", a.updateURL = "", t.URLs = a
- }, function(e, t) {
- "use strict";
- var n = function() {
- function e(e) {
- this.progress = 0, this.maximumValue = 0, this.progressCallback = e
- }
- return e.prototype.addProgress = function(e) {
- this.progress += e, this.progressCallback(this.progress)
- }, e.prototype.getPercentage = function() {
- return this.progress / this.maximumValue * 100
- }, e
- }();
- t.Progress = n
- }, function(e, t, n) {
- "use strict";
- var r = n(3),
- i = n(8),
- s = n(13),
- o = n(4),
- a = n(2),
- l = n(10),
- c = n(21),
- u = n(23),
- f = n(1),
- h = n(18),
- p = function() {
- function e(e, t, n) {
- this.memory = e, this.username = t, this.sessionID = n, this.additionalArgs = ""
- }
- return e.prototype.launch = function() {
- var e = this;
- return new f(function(t, n) {
- var p = "",
- d = "";
- (new h.URLs).minecraftVersionURL().then(r.Utils.getRemoteJSON).then(function(t) {
- 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")
- }).catch(function(e) {
- n(new o.CustomError("Hiba történt a kliens indítása közben!", 201, e))
- }).then(function() {
- return r.Utils.getFilesInDirectory(i.join(r.Utils.getWorkingDirectory(), "libraries"))
- }).then(function(t) {
- return new f(function(n, f) {
- for (var h in t) p += "win32" == process.platform ? t[h].path + ";" : t[h].path + ":";
- p += i.join(r.Utils.getWorkingDirectory(), "minecraft.jar");
- var g = new Array;
- 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, {
- cwd: r.Utils.getWorkingDirectory(),
- detached: !1
- }), e.process.on("error", function(e) {
- f(new o.CustomError("Hiba történt a kliens indítása közben!", 202, e.message))
- });
- var E = !1;
- e.process.stdout.on("data", function(e) {
- 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."))
- }), l.ensureFileSync(i.join(r.Utils.getWorkingDirectory(), "logs", "pixelhero.log"));
- var v = l.createWriteStream(i.join(r.Utils.getWorkingDirectory(), "logs", "pixelhero.log"));
- e.process.stderr.pipe(v), e.process.stdout.pipe(v), e.process.on("exit", function(e) {
- 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))
- })
- })
- }).catch(n)
- })
- }, e.prototype.kill = function() {
- this.process && this.process.kill()
- }, e
- }();
- t.MinecraftLauncher = p
- }, function(e, t, n) {
- "use strict";
- var r = this && this.__extends || function(e, t) {
- function n() {
- this.constructor = e
- }
- for (var r in t) t.hasOwnProperty(r) && (e[r] = t[r]);
- e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, new n)
- },
- i = n(22),
- s = function(e) {
- function t() {
- return null !== e && e.apply(this, arguments) || this
- }
- return r(t, e), t
- }(i.EventEmitter);
- t.EventBus = new s, t.EventBus.setMaxListeners(0)
- }, function(e, t) {
- e.exports = require("events")
- }, function(e, t) {
- "use strict";
- var n = function() {
- function e() {}
- return e
- }();
- n.LAUNCH_FINISHED = "LAUNCH_FINISHED", t.BackendEvents = n
- }, function(e, t) {
- "use strict";
- var n = function() {
- function e() {}
- return e
- }();
- 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
- }, function(e, t) {
- e.exports = require("electron-squirrel-startup")
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement