Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ! function(t) {
- var e = {};
- function s(i) {
- if (e[i]) return e[i].exports;
- var n = e[i] = {
- i: i,
- l: !1,
- exports: {}
- };
- return t[i].call(n.exports, n, n.exports, s), n.l = !0, n.exports
- }
- s.m = t, s.c = e, s.d = function(t, e, i) {
- s.o(t, e) || Object.defineProperty(t, e, {
- configurable: !1,
- enumerable: !0,
- get: i
- })
- }, s.r = function(t) {
- Object.defineProperty(t, "__esModule", {
- value: !0
- })
- }, s.n = function(t) {
- var e = t && t.__esModule ? function() {
- return t.default
- } : function() {
- return t
- };
- return s.d(e, "a", e), e
- }, s.o = function(t, e) {
- return Object.prototype.hasOwnProperty.call(t, e)
- }, s.p = "", s(s.s = 36)
- }([function(t, e) {
- t.exports = class {
- constructor(t) {
- this.game = t, this.loaded = !1
- }
- openPanel() {
- this.appendPanel(), this.loaded || (this.appendLanguages(), this.loaded = !0), $(".problem, .back").hide(), $("#languagesModal").css({
- display: "table!important"
- }), $("#languagesModal").addClass("bouncein")
- }
- appendPanel() {
- $("#languagesModal").show()
- }
- appendLanguages() {
- if ($("#languagesModalBody").is(":empty")) {
- for (var t = ["Russian", "Spanish", "English", "French", "Italian", "Arabic", "Turkish", "Dutch"], e = t.sort(function(t, e) {
- return t < e ? -1 : t > e ? 1 : 0
- }), s = "", i = 0; i < t.length; i++) s += `<button class="btn btnLanguages" onclick="window.translate('${e[i].toLowerCase()}')"> <font style="vertical-align: inherit;">${e[i]}</font> </button>`;
- $("#languagesModalBody").append(s)
- }
- }
- closePanel() {
- $("#languagesModal").addClass("bounceout"), $("#languagesModal").removeClass("bouncein"), setTimeout(this.removePanel, 500)
- }
- removePanel() {
- $("#languagesModal").removeClass("bounceout"), $("#languagesModal").hide()
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor(t) {
- this.game = t, this.hotkeys = {}, this.init()
- }
- init() {
- this.hotkeys = {
- split: {
- name: "Split",
- value: "SPACE",
- keyCode: 32
- },
- macroFeed: {
- name: "Macro Feed",
- value: "W",
- keyCode: 87
- },
- doubleSplit: {
- name: "Double Split",
- value: "Q",
- keyCode: 81
- },
- x16Split: {
- name: "x16 Split",
- value: "T",
- keyCode: 84
- }
- }, this.loadLocalStorage()
- }
- loadLocalStorage() {
- var t = localStorage.getItem("hotkeys");
- try {
- var e = JSON.parse(t);
- e && (this.hotkeys = e)
- } catch (t) {}
- }
- openPanel() {
- this.appendPanel(), this.appendHotkeys(), $(".problem, .back").hide(), $("#hotkeysModal").css({
- display: "table!important"
- }), $("#hotkeysModal").addClass("bouncein")
- }
- appendPanel() {
- $("#game").append('\n\t\t\t<div class="modal fade" id="hotkeysModal" role="dialog">\n\t\t <div class="modal-dialog" style="width: 500px!important;">\n\t\t <div class="modal-content" id="hotkeysModal">\n\t\t <div class="modal-header">\n\t\t <h4 class="modal-title">Change Hotkeys</h4>\n\t\t </div>\n\t\t <div id="hotkeysModalBody" class="modal-body" style="max-height: 445px;overflow: auto;"></div>\n\t\t <div class="modal-footer">\n\t \t<button id="btnShopClose" type="button" class="btn btn-danger" onclick="game.hotkeys.closePanel(); return false;">Close</button>\n\t \t</div>\n\t \t</div>\n\t \t</div>\n\t </div>\n\t ')
- }
- appendHotkeys() {
- if ($("#hotkeysModalBody").is(":empty")) {
- var t = "";
- for (var e in this.hotkeys) {
- var s = this.hotkeys[e];
- t += `<div id="hotkeySection"> <div class="hotkeyName"> <p class="hotkeyTrigger">${s.name}</p> </div> <div class="hotkeyCode"> <input class="form-control key" id="hotkey${e}" type="text" onkeydown="game.hotkeys.changeKey('hotkey${e}', event)" code="${e}" value="${s.value}"> </div> </div>`
- }
- $("#hotkeysModalBody").append(t)
- }
- }
- changeKey(t, e) {
- var s = $("#" + t);
- s.val(this.getPressedKey(e)), this.hotkeys[s.attr("code")].keyCode = e.keyCode, this.hotkeys[s.attr("code")].value = this.getPressedKey(e), localStorage.setItem("hotkeys", JSON.stringify(this.hotkeys)), e.preventDefault()
- }
- getPressedKey(t) {
- var e = "";
- return 8 == t.keyCode || 46 == t.keyCode ? e += "" : 9 == t.keyCode ? e += "TAB" : 16 == t.keyCode ? e += "SHIFT" : 32 == t.keyCode ? e += "SPACE" : e += String.fromCharCode(t.keyCode), e
- }
- closePanel() {
- $("#hotkeysModal").addClass("bounceout"), $("#hotkeysModal").removeClass("bouncein"), setTimeout(this.removePanel, 500)
- }
- removePanel() {
- $("#hotkeysModal").remove()
- }
- }
- }, function(t, e) {
- t.exports = '<div id="skinsPage">\n <ul id="tabHolder" class="nav nav-tabs skinTabs"></ul>\n\t<div id="navBar"></div>\n</div>\n'
- }, function(t, e) {
- t.exports = '<div id="coins">\n <div id="coin">\n <p class="coinsAmount">1,000</p>\n <img src="http://i.imgur.com/5mW0rX7.png" class="buyCoinImg">\n <p class="coinPrice">USD$1.00</p>\n <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">\n <input type="hidden" name="cmd" value="_s-xclick">\n <input type="hidden" name="hosted_button_id" value="6VL43CC55HFEA">\n <input id="fbId" type="hidden" name="custom" value="none">\n <button onclick="" class="btn buyCoin">BUY</button>\n </form>\n </div>\n <div id="coin"> \n <p class="coinsAmount">5,000</p>\n <img src="http://i.imgur.com/5mW0rX7.png" class="buyCoinImg">\n <p class="coinPrice">USD$4.50</p>\n <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">\n <input type="hidden" name="cmd" value="_s-xclick">\n <input type="hidden" name="hosted_button_id" value="8TG76M4XNF4AL">\n <input type="hidden" name="custom" value="">\n <button onclick="" class="btn buyCoin">BUY</button>\n </form>\n </div>\n <div id="coin"> \n <p class="coinsAmount">10,000</p>\n <img src="http://i.imgur.com/5mW0rX7.png" class="buyCoinImg">\n <p class="coinPrice">USD$8.00</p>\n <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">\n <input type="hidden" name="cmd" value="_s-xclick">\n <input type="hidden" name="hosted_button_id" value="3JVEWUU8WV43W">\n <input type="hidden" name="custom" value="">\n <button onclick="" class="btn buyCoin">BUY</button>\n </form>\n </div>\n <div id="coin"> \n <p class="coinsAmount">50,000</p>\n <img src="http://i.imgur.com/5mW0rX7.png" class="buyCoinImg">\n <p class="coinPrice">USD$30.00</p>\n <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">\n <input type="hidden" name="cmd" value="_s-xclick">\n <input type="hidden" name="hosted_button_id" value="RW7FEQCSE9MAG">\n <input type="hidden" name="custom" value="">\n <button onclick="" class="btn buyCoin">BUY</button>\n </form>\n </div>\n <div id="coin"> \n <p class="coinsAmount">100,000</p>\n <img src="http://i.imgur.com/5mW0rX7.png" class="buyCoinImg">\n <p class="coinPrice">USD$50.00</p> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">\n <input type="hidden" name="cmd" value="_s-xclick">\n <input type="hidden" name="hosted_button_id" value="M8796SVT7RYFG">\n <input type="hidden" name="custom" value="">\n <button onclick="" class="btn buyCoin">BUY</button>\n </form>\n </div>\n</div>'
- }, function(t, e) {
- t.exports = '<div id="xpBoost">\n <div class="item1">\n <p class="itemTitle">Double XP Boost</p> \n <div class="doubleXp">\n <img src="images/xp-x2.png" class="imgDoubleXp"> \n <p class="time1">1 Hour</p> \n <button id="boostx2" class="btn buyBoost doubleXP1hr">290</button> \n <hr class="divider"> \n <p class="time2">24 Hours</p> \n <button id="boostx3" class="btn buyBoost doubleXP24hr">780</button> \n </div> \n </div>\n <div class="item2">\n <p class="itemTitle">Triple XP Boost</p>\n <div class="tripleXp">\n <img src="images/xp-x3.png" class="imgTripleXp"> \n <p class="time1">1 Hour</p> \n <button id="boostx2" class="btn buyBoost tripleXP1hr">490</button> \n <hr class="divider"> \n <p class="time2">24 Hours</p> \n <button id="boostx3" class="btn buyBoost tripleXP24hr">990</button> \n </div> \n </div>\n</div>'
- }, function(t, e) {
- t.exports = '<div id="shopMenu">\r\n\t<div id="coinsShop">\r\n\t\t<img src="http://cellz.io/path/img/Coins.png" id="shopImg">\r\n\t</div>\r\n\t<div id="massShop">\r\n\t\t<img src="http://cellz.io/path/img/Mass.png" id="shopImg">\r\n\t</div>\r\n\t<div id="xpShop">\r\n\t\t<img src="http://cellz.io/path/img/XP.png" id="shopImg">\r\n\t</div>\r\n\t<div id="skinsShop">\r\n\t\t<img src="http://cellz.io/path/img/Skins.png" id="shopImg">\r\n\t</div>\r\n</div>'
- }, function(t, e) {
- t.exports = '<div id="massBoost">\n <div class="item1">\n <p class="itemTitle">Double Mass Boost</p> \n <div class="doubleMass">\n <img src="images/mass-x2.png" class="imgDoubleMass"> \n <p class="time1">1 Hour</p> \n <button id="boostx2" class="btn buyBoost doubleMass1hr">290</button> \n <hr class="divider"> \n <p class="time2">24 Hours</p> \n <button id="boostx3" class="btn buyBoost doubleMass24hr">780</button> \n </div> \n </div>\n <div class="item2">\n <p class="itemTitle">Triple Mass Boost</p>\n <div class="tripleMass">\n <img src="images/mass-x3.png" class="imgTripleMass"> \n <p class="time1">1 Hour</p> \n <button id="boostx2" class="btn buyBoost tripleMass1hr">490</button> \n <hr class="divider"> \n <p class="time2">24 Hours</p> \n <button id="boostx3" class="btn buyBoost tripleMass24hr">990</button>\n </div> \n </div>\n</div>'
- }, function(t, e) {
- window.genKey = function(t) {
- return t ^= 1614, t >>>= 2, t |= 6215, t ^= 21571791
- }
- }, function(t, e, s) {
- "use strict";
- s.r(e);
- var i = s(2),
- n = s.n(i);
- var o = function(t, e) {
- var s, i = [];
- for (s = 0; s < t.length; s += e) i.push(t.slice(s, s + e));
- return i
- };
- e.default = class {
- constructor(t) {
- this.api = t, this.loaded = !1, this.skinContents = {
- Owned: {},
- Premium: {},
- Youtuber: {}
- }, this.selectedTab = "Premium", this.page = 0, this.pages = [], this.sortedSkins = {}, this.selectedSkin = t.game.settings.get("selectedSkin"), this.id = "skinsPage"
- }
- show() {
- this.loaded || ($("#shopModalBody").append(n.a), this.loaded = !0), this.refresh(), $("#" + this.id).show()
- }
- async refresh() {
- for (var t in $("#skinsPage").html('<ul id="tabHolder" class="nav nav-tabs skinTabs"></ul>'), this.skinContents) $("#tabHolder").append(`\n\t\t\t <li id="${t}Holder" class="">\n\t\t\t\t <a href="#">${t}</a>\n\t\t\t </li>\n\t\t\t`);
- for (var t in $(`#${this.selectedTab}Holder`).addClass("active"), await this.getSortedSkins(), this.skinContents) this.createTab(t);
- this.setPage(this.page), $(".ytQ").remove(), "Youtuber" == name && $(".modal-footer").append('<p class="problem ytQ">Are you a YouTuber and want your skin here too? Contact us on <a href="https://discord.gg/Tz79P5t" target="_blank">Discord!</a></p>')
- }
- createTab(t) {
- $("#skinsPage").append(`<div id="${t}Tab" stlye="display:none"></div>`), $(`#${t}Holder`).click(function() {
- this.switchTab(t)
- }.bind(this))
- }
- async switchTab(t) {
- if (console.log(t), t == this.selectedTab) return;
- $(`#${this.selectedTab}Tab`).hide(), $(`#${this.selectedTab}Tab`).html(""), $(`#${this.selectedTab}Holder`).removeClass("active"), $(`#${t}Holder`).addClass("active"), $(`#${t}Tab`).show(), await this.getSortedSkins(), this.selectedTab = t, this.setPage(0);
- let e = null;
- for (var s in this.skinContents.Owned) this.skinContents.Owned[s].name == this.selectedSkin && (e = this.skinContents.Owned[s]);
- "Owned" == t && this.selectedSkin && this.handleSkinClick(e), $(".ytQ").remove(), "Youtuber" == t && $(".modal-footer").append('<p class="problem ytQ">Are you a YouTuber and want your skin here too? Contact us on <a href="https://discord.gg/Tz79P5t" target="_blank">Discord!</a></p>')
- }
- setPage(t) {
- let e = o(this.skinContents[this.selectedTab], 3);
- if (0 == e.length && $(`#${this.selectedTab}Tab`).html('<p class="noSkins">No Skins Avaliable!</p>'), !e[t]) return;
- for (var s in console.log("setting page", t), this.page = t, $(`#${this.selectedTab}Tab`).html(""), e[this.page]) {
- let t = e[this.page][s],
- n = this.getSkinName(t.name),
- o = ` \n\t\t\t\t<div id="skin">\n\t\t\t\t\t<div id="skinBlock">\n\t\t\t\t\t\t<p class="skinTitle ${t.name}">${n}</p>\n\t\t\t\t\t\t<img src="http://cellz.io/skins/${t.name}.png" id="skinImage">\n\t\t\t\t\t</div>\n\t\t\t\t\t<button id="button-${t.name}" class="btn buySkin">${t.owned?"USE":t.cost}</button>\n\t\t\t\t</div>`;
- $(`#${this.selectedTab}Tab`).append(o);
- var i = this;
- $(`#button-${t.name}`).click(function() {
- i.handleSkinClick(t)
- })
- }
- let n = null;
- for (var s in this.skinContents.Owned) this.skinContents.Owned[s].name == this.selectedSkin && (n = this.skinContents.Owned[s]);
- "Owned" == this.selectedTab && this.selectedSkin && this.handleSkinClick(n), this.updateNavBar()
- }
- handleSkinClick(t) {
- if (t)
- if (t.owned) {
- console.log(t, this.selectedSkin), this.selectedSkin && ($(`#button-${this.selectedSkin}`).attr("style", ""), $(`#button-${this.selectedSkin}`).text("USE"));
- let e = $(`#button-${t.name}`);
- e.css("background-color", "rgb(217, 83, 79)"), e.text("CANCEL"), this.selectedSkin = t.name, this.api.game.settings.set("selectedSkin", this.selectedSkin, "value"), this.api.game.socket.skin = t.name
- } else this.api.utils.buyItem(t.name).then(function() {
- this.refresh(), t.owned = !0, this.handleSkinClick(t)
- }.bind(this));
- else console.log("returning", t)
- }
- updateNavBar() {
- var t = $(`#${this.selectedTab}Tab`),
- e = function(t, e) {
- var s = [];
- return 1 == e && (s = [0, 1]), e < 2 ? s : (t < e && 0 !== t ? s = [t - 1, t, t + 1] : t == e && 0 !== t ? s = [t - 2, t - 1, t] : 0 == t && (s = [t, t + 1, t + 2]), s)
- }(this.page, o(this.skinContents[this.selectedTab], 3).length - 1),
- s = "";
- for (var i in e) e[i], this.page, s += `<li id="navPage${e[i]}" class="page-item"><a class="page-link" href="#">${e[i]+1}</a></li>`;
- t.append(`<nav><ul class="pagination"><li id="backwardNav" class="page-item"><a class="page-link" href="#" aria-label="Previous"><span aria-hidden="true">«</span><span class="sr-only">Previous</span></a></li>${s}<li id="forwardNav" class="page-item"><a class="page-link" href="#" aria-label="Next"><span aria-hidden="true">»</span><span class="sr-only">Next</span></a></li></ul></nav>`);
- var n = this;
- for (var i in e) $(`#navPage${e[i]}`).off(), $(`#navPage${e[i]}`).click(function() {
- console.log(parseInt(this.id.split("navPage")[1])), n.setPage(parseInt(this.id.split("navPage")[1]))
- });
- $("#backwardNav").click(function() {
- this.setPage(this.page - 1)
- }.bind(this)), $("#forwardNav").click(function() {
- this.setPage(this.page + 1)
- }.bind(this))
- }
- getSkinName(t) {
- var e = t.split("_").splice(1, 3);
- for (var s in e) {
- var i = e[s].split("");
- i[0] = i[0].toUpperCase(), e[s] = i.join("")
- }
- return e = e.join(" ")
- }
- getSortedSkins() {
- return new Promise(async function(t, e) {
- let s = await this.api.utils.getShopItems();
- for (var i in this.skinContents = {
- Owned: [],
- Premium: [],
- Youtuber: []
- }, s) {
- let t = s[i];
- if (t.name.indexOf("skin_") >= 0) {
- if (!t.showInShop) continue;
- let e = !1;
- for (var i in this.api.info.items) this.api.info.items[i].name == t.name && (e = !0);
- e ? (t.owned = !0, this.skinContents.Owned.push(t)) : t.youtuber ? this.skinContents.Youtuber.push(t) : this.skinContents.Premium.push(t)
- }
- }
- for (var i in this.skinContents) this.skinContents[i] = this.skinContents[i].sort(function(t, e) {
- return t.cost - e.cost
- });
- t()
- }.bind(this))
- }
- close() {
- $("#" + this.id).hide()
- }
- }
- }, function(t, e, s) {
- "use strict";
- s.r(e);
- var i = s(3),
- n = s.n(i);
- e.default = class {
- constructor(t) {
- this.api = t, this.loaded = !1, this.id = "coins"
- }
- show() {
- this.loaded || ($("#shopModalBody").append(n.a), this.loaded = !0), $("#" + this.id).show(), $(".modal-footer").append('<p class="problem">Problem with purchasing coins? Contact us on <a href="https://discord.gg/Tz79P5t" target="_blank">Discord!</a></p>')
- }
- close() {
- $(".problem").remove(), $("#" + this.id).hide()
- }
- }
- }, function(t, e, s) {
- "use strict";
- s.r(e);
- var i = s(4),
- n = s.n(i);
- e.default = class {
- constructor(t) {
- this.api = t, this.loaded = !1, this.id = "xpBoost"
- }
- show() {
- this.loaded || ($("#shopModalBody").append(n.a), $(".doubleXP1hr").click(function() {
- this.api.utils.buyItem("xp_boost_2_1")
- }.bind(this)), $(".doubleXP24hr").click(function() {
- this.api.utils.buyItem("xp_boost_2_24")
- }.bind(this)), $(".tripleXP1hr").click(function() {
- this.api.utils.buyItem("xp_boost_3_1")
- }.bind(this)), $(".tripleXP24hr").click(function() {
- this.api.utils.buyItem("xp_boost_3_24")
- }.bind(this)), this.loaded = !0), $("#" + this.id).show()
- }
- close() {
- $("#" + this.id).hide()
- }
- }
- }, function(t, e, s) {
- "use strict";
- s.r(e);
- var i = s(5),
- n = s.n(i);
- e.default = class {
- constructor(t) {
- this.api = t, this.loaded = !1, this.id = "shopMenu"
- }
- show() {
- if (!this.loaded) {
- for (var t in $("#shopModalBody").append(n.a), this.api.shop.pages)
- if ("menu" !== t) {
- var e = this;
- $(`#${t}Shop > img`).click(function() {
- e.api.shop.switchPage($(this).parent()[0].id.split("Shop")[0])
- })
- }
- this.loaded = !0
- }
- $("#shopBack").hide(), $("#" + this.id).show()
- }
- close() {
- $("#" + this.id).hide()
- }
- }
- }, function(t, e, s) {
- "use strict";
- s.r(e);
- var i = s(6),
- n = s.n(i);
- e.default = class {
- constructor(t) {
- this.api = t, this.loaded = !1, this.id = "massBoost"
- }
- show() {
- this.loaded || ($("#shopModalBody").append(n.a), console.log($(".doubleMass1hr")), $(".doubleMass1hr").click(function() {
- this.api.utils.buyItem("mass_boost_2_1")
- }.bind(this)), $(".doubleMass24hr").click(function() {
- this.api.utils.buyItem("mass_boost_2_24")
- }.bind(this)), $(".tripleMass1hr").click(function() {
- this.api.utils.buyItem("mass_boost_3_1")
- }.bind(this)), $(".tripleMass24hr").click(function() {
- this.api.utils.buyItem("mass_boost_3_24")
- }.bind(this)), this.loaded = !0), $("#" + this.id).show()
- }
- close() {
- $("#" + this.id).hide()
- }
- }
- }, function(t, e, s) {
- t.exports = class {
- constructor(t) {
- this.api = t, this.pages = {
- mass: new(s(12).default)(t),
- menu: new(s(11).default)(t),
- xp: new(s(10).default)(t),
- coins: new(s(9).default)(t),
- skins: new(s(8).default)(t)
- }, this.init()
- }
- init() {
- $("#btnShopClose").click(function() {
- this.close()
- }.bind(this)), $("#shopBack").click(function() {
- this.switchPage("menu")
- }.bind(this));
- var t = this;
- $("#infoModal").ready(function() {
- $("#btnProfileClose").click(function() {
- $("#infoModal").removeClass("bouncein"), $("#infoModal").addClass("bounceout"), setTimeout(function() {
- $("#infoModal").removeClass("bounceout")
- }, 500)
- }), $("#level").click(async function() {
- if (t.api.loggedIn) {
- $("#infoModal").removeClass("bounceout"), $("#infoModal").addClass("bouncein");
- let e = await t.api.platform.getInfo(),
- s = await t.api.platform.getId();
- $(".accountName").text(e.name), $(".accountId").text("G+ ID: " + s)
- } else t.api.utils.showError("You must login to view your profile")
- })
- });
- for (var e = 0; e < 2; e++) $($(".coinBox")[e]).click(function() {
- this.open(), this.switchMenu("coins")
- }.bind(this))
- }
- open() {
- this.api.loggedIn ? ($("[name='custom']").val(this.id), this.hideAllPages(), this.switchPage("menu"), $("#shopModal").css({
- display: "table!important"
- }), $("#shopModal").addClass("bouncein")) : this.api.utils.showError("You must login to access the shop")
- }
- close() {
- $("#shopModal").addClass("bounceout"), $("#shopModal").removeClass("bouncein"), setTimeout(() => {
- $("#shopModal").removeClass("bounceout")
- }, 500)
- }
- hideAllPages() {
- for (var t in this.pages) this.pages[t].close()
- }
- switchPage(t) {
- this.hideAllPages(), $("#shopBack").show();
- var e = !this.pages[t].loaded;
- this.pages[t].show(), e && window.reTranslate()
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor(t) {
- this.api = t
- }
- getJWT(t, e) {
- return new Promise(function(s, i) {
- $.get(`${this.api.baseURL}?id=${t}&token=${e}&platform=${this.api.platform.type}`, t => {
- s(t)
- })
- }.bind(this))
- }
- getUser(t) {
- return new Promise(function(e, s) {
- $.get(`${this.api.baseURL}/user/${t}`, t => {
- e(JSON.parse(t))
- })
- }.bind(this))
- }
- buyItem(t) {
- return new Promise(function(e, s) {
- $.post(`${this.api.baseURL}/buy`, {
- jwt: this.api.game.socket.jwt,
- item: t
- }, async function(t) {
- await this.api.updateInfo();
- let s = await this.api.platform.getId(),
- i = await this.api.platform.getAccessToken();
- this.api.game.socket.jwt = await this.getJWT(s, i), this.api.game.socket.sendJWT();
- let n = await this.api.platform.getInfo(),
- o = await this.api.updateInfo();
- this.api.setInfo(n, o), "You Have Successfully Bought This Item!" == t ? this.showSuccess(t) : this.showError(t), e(t)
- }.bind(this))
- }.bind(this))
- }
- showSuccess(t) {
- t = getText(t), swal({
- title: t,
- icon: "success"
- }), this.closeSwal()
- }
- showError(t) {
- t = getText(t), swal({
- title: t,
- icon: "error"
- }), this.closeSwal()
- }
- showAlert(t) {
- t = getText(t), swal({
- title: "Are you sure?",
- text: t,
- icon: "warning",
- buttons: !0,
- dangerMode: !0
- }), this.closeSwal()
- }
- closeSwal() {
- $(".swal-button").click(() => {
- $(".swal-overlay").addClass("bounceout"), $(".swal-overlay").removeClass("bouncein"), setTimeout(() => {
- $(".swal-overlay").remove()
- }, 1e3)
- })
- }
- getShopItems() {
- return new Promise(function(t, e) {
- $.get("http://main.cellz.io:8081/shop", function(e) {
- t(JSON.parse(e))
- })
- })
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor() {
- this.googleUser = null, this.type = "google"
- }
- loggedIn() {
- return new Promise(async function(t, e) {
- gapi.auth2.getAuthInstance().isSignedIn.get() ? (this.googleUser = gapi.auth2.getAuthInstance().currentUser.get(), t(!0)) : t(!1)
- }.bind(this))
- }
- login() {
- return new Promise(async function(t, e) {
- let s = await auth2.signIn();
- this.googleUser = s, t()
- }.bind(this))
- }
- logout() {
- return new Promise(async function(t, e) {
- await auth2.signOut(), t()
- }.bind(this))
- }
- getInfo() {
- return new Promise(function(t, e) {
- let s = {
- profilePic: "",
- name: "",
- id: this.getId()
- },
- i = this.googleUser.getBasicProfile();
- s.profilePic = i.getImageUrl(), s.name = i.getName().split(" ")[0], t(s)
- }.bind(this))
- }
- getAccessToken() {
- return new Promise(function(t, e) {
- t(this.googleUser.getAuthResponse().id_token)
- }.bind(this))
- }
- getId() {
- return this.googleUser.getBasicProfile().getId()
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor() {
- console.log("init facebook!")
- }
- }
- }, function(t, e, s) {
- const i = s(16),
- n = s(15),
- o = s(14),
- a = s(13);
- t.exports = class {
- constructor(t) {
- this.platforms = {
- facebook: new i(this),
- google: new n(this)
- }, this.platform = this.platforms.google, this.baseURL = "http://main.cellz.io:8081", this.game = t, this.utils = new o(this), this.shop = new a(this), this.info = {}, this.loggedIn = !1
- }
- async init() {
- await this.platform.loggedIn() && this.handleLogin()
- }
- handleLogin() {
- return new Promise(async function(t, e) {
- let s = await this.platform.getInfo(),
- i = await this.platform.getAccessToken(),
- n = await this.utils.getJWT(s.id, i);
- this.loggedIn = !0, this.game.socket.jwt = n, this.game.socket.sendJWT();
- let o = await this.updateInfo();
- this.setInfo(s, o), $("#login").hide(), $("#logout").show()
- }.bind(this))
- }
- updateInfo() {
- return new Promise(async function(t, e) {
- let s = await this.utils.getUser(this.platform.getId());
- this.info = s, t(s)
- }.bind(this))
- }
- login() {
- if (!this.loggedIn) return new Promise(async function(t, e) {
- await this.platform.login(), await this.handleLogin(), t(!0)
- }.bind(this))
- }
- logout() {
- return new Promise(async function(t, e) {
- await this.platform.logout(), this.loggedIn = !1, this.setInfo({
- profilePic: "http://cellz.io/path/img/profile.png",
- name: "Guest"
- }, {
- coins: 0,
- xp: 0
- }), $("#logout").hide(), $("#login").show(), t(!0)
- }.bind(this))
- }
- async setInfo(t, e) {
- $(".userImg").attr("src", t.profilePic), $(".userName").html(t.name), $(".coinAmount").html(e.coins);
- let s = e.xp,
- i = Math.ceil(Math.sqrt(s / 1e3)),
- n = (Math.floor(i) + 1) ** 2 * 1e3;
- $(".progressImg").html(i), $(".xp").html(s + " / " + n), $(".xpProgress").css("width", `${(s/n*87.5).toFixed(2)}%`)
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor() {
- this.accepted = JSON.parse(localStorage.getItem("acceptedCookies")), this.init()
- }
- init() {
- window.addEventListener("load", function() {
- this.accepted || game.cookie.decline(), window.cookieconsent.initialise({
- palette: {
- popup: {
- background: "#fff",
- text: "#000"
- },
- button: {
- background: "#eee"
- }
- },
- theme: "edgeless",
- position: "bottom-right",
- content: {
- message: "We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you've provided to them or that they've collected from your use of their services. You consent to our cookies if you continue to use our website. <br><a href='/pp.html' target='_blank' style='color: #000!important; text-decoration: underline;''>Privacy & Cookie Policy</a> or",
- dismiss: "ACCEPT",
- link: "Read more"
- }
- }), game.cookie.run()
- }.bind(this))
- }
- run() {
- $(".cc-btn").replaceWith('\n\t\t\t<a aria-label="dismiss cookie message" role="button" tabindex="0" class="cc-btn cc-dismiss accept" style="min-width:120px;width:125px;">Accept</a>\n\t\t\t<a aria-label="dismiss cookie message" role="button" tabindex="0" class="cc-btn cc-dismiss decline" style="min-width:120px;width:125px;">Decline</a>\n\t\t'), $(".accept").click(function() {
- game.cookie.accept()
- }), $(".decline").click(function() {
- localStorage.setItem("acceptedCookies", "false"), game.cookie.decline(), aiptag.consented = !1
- }), console.log("User not from Europe")
- }
- accept() {
- localStorage.setItem("acceptedCookies", "true")
- }
- decline() {
- localStorage.clear();
- for (var t = document.cookie.split(";"), e = 0; e < t.length; e++) {
- var s = t[e],
- i = s.indexOf("="),
- n = i > -1 ? s.substr(0, i) : s;
- document.cookie = n + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT"
- }
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor(t) {
- this.game = t, this.ip = "ws://main.cellz.io:9091", this.socket = null, this.init()
- }
- init() {
- this.connect(), setInterval(function() {
- this.sendInfo()
- }.bind(this), 800)
- }
- connect() {
- this.socket = io(this.ip)
- }
- sendInfo() {
- this.socket.emit("info", {
- fps: this.game.scene.fps
- })
- }
- }
- }, function(t, e) {
- t.exports = {
- NA: {
- "FFA-1": {
- gamemode: "FFA",
- port: 443,
- stats: 88,
- ip: "149.56.99.188"
- },
- "Big-FFA-1": {
- gamemode: "BIG-FFA",
- port: 444,
- stats: 89,
- ip: "149.56.99.188"
- },
- "Instant-1": {
- gamemode: "INSTANT",
- port: 8080,
- stats: 90,
- ip: "149.56.99.188"
- },
- "MegaSplit-1": {
- gamemode: "MEGASPLIT",
- port: 1001,
- stats: 92,
- ip: "149.56.99.188"
- }
- },
- EU: {
- "FFA-1": {
- gamemode: "FFA",
- port: 443,
- stats: 88,
- ip: "51.38.185.177"
- },
- "Big-FFA-1": {
- gamemode: "BIG-FFA",
- port: 444,
- stats: 89,
- ip: "51.38.185.177"
- },
- "Instant-1": {
- gamemode: "INSTANT",
- port: 8080,
- stats: 90,
- ip: "51.38.185.177"
- },
- "MegaSplit-1": {
- gamemode: "MEGASPLIT",
- port: 1001,
- stats: 92,
- ip: "51.38.185.177"
- }
- },
- AS: {
- "FFA-1": {
- gamemode: "FFA",
- port: 443,
- stats: 88,
- ip: "139.59.18.142"
- },
- "Big-FFA-1": {
- gamemode: "BIG-FFA",
- port: 444,
- stats: 89,
- ip: "139.59.18.142"
- },
- "Instant-1": {
- gamemode: "INSTANT",
- port: 8080,
- stats: 90,
- ip: "139.59.18.142"
- },
- "MegaSplit-1": {
- gamemode: "MEGASPLIT",
- port: 1001,
- stats: 92,
- ip: "139.59.18.142"
- }
- }
- }
- }, function(t, e, s) {
- t.exports = class {
- constructor(t) {
- this.game = t, this.region = "NA", this.gamemode = "FFA", this.selectedServer = null, this.servers = s(20)
- }
- init() {
- var t = localStorage.getItem("region");
- t ? (this.setRegion(t), $("#chooseRegion").val(this.region), this.updatePanel()) : this.getRegion(function(t) {
- this.setRegion(t), this.updatePanel()
- }.bind(this))
- }
- setGamemode(t) {
- this.gamemode = t, console.log(this.region), this.updatePanel(), this.setServer(this.region, this.gamemode)
- }
- setRegion(t) {
- this.region = t, this.updatePanel(), this.setServer(this.region, this.gamemode)
- }
- updatePanel() {
- let t = this.servers[this.region],
- e = [];
- for (var s in t) t[s].gamemode == this.gamemode && e.push(s);
- var i = '<div id="selectServers"> <h1 class="selectServer">Select A Server</h1>';
- for (var s in console.log(e), e) i += `<a class="server" href="#" onclick="game.socket.connect('ws://${t[e[s]].ip}:${t[e[s]].port}')">${this.region} ${this.gamemode}<span class="label serverNum blue">${parseInt(s)+1}</span></a>`;
- $(".serverPanel").html(i + "</div>")
- }
- setServer(t, e) {
- localStorage.setItem("region", this.region);
- let s = this.servers[t],
- i = [];
- for (var n in s) s[n].gamemode == e && i.push(n);
- let o = s[i[Math.floor(Math.random() * i.length)]];
- this.selectedServer = o, this.game.socket.connect("ws://" + o.ip + ":" + o.port)
- }
- getRegion(t) {
- $.get("http://ip-api.com/json", function(e) {
- t({
- BD: "AS",
- BE: "EU",
- BF: "AF",
- BG: "EU",
- BA: "EU",
- BB: "NA",
- WF: "OC",
- BL: "NA",
- BM: "NA",
- BN: "AS",
- BO: "SA",
- BH: "AS",
- BI: "AF",
- BJ: "AF",
- BT: "AS",
- JM: "NA",
- BV: "AN",
- BW: "AF",
- WS: "OC",
- BQ: "NA",
- BR: "SA",
- BS: "NA",
- JE: "EU",
- BY: "EU",
- BZ: "NA",
- RU: "EU",
- RW: "AF",
- RS: "EU",
- TL: "OC",
- RE: "AF",
- TM: "AS",
- TJ: "AS",
- RO: "EU",
- TK: "OC",
- GW: "AF",
- GU: "OC",
- GT: "NA",
- GS: "AN",
- GR: "EU",
- GQ: "AF",
- GP: "NA",
- JP: "AS",
- GY: "SA",
- GG: "EU",
- GF: "SA",
- GE: "AS",
- GD: "NA",
- GB: "EU",
- GA: "AF",
- SV: "NA",
- GN: "AF",
- GM: "AF",
- GL: "NA",
- GI: "EU",
- GH: "AF",
- OM: "AS",
- TN: "AF",
- JO: "AS",
- HR: "EU",
- HT: "NA",
- HU: "EU",
- HK: "AS",
- HN: "NA",
- HM: "AN",
- VE: "SA",
- PR: "NA",
- PS: "AS",
- PW: "OC",
- PT: "EU",
- SJ: "EU",
- PY: "SA",
- IQ: "AS",
- PA: "NA",
- PF: "OC",
- PG: "OC",
- PE: "SA",
- PK: "AS",
- PH: "AS",
- PN: "OC",
- PL: "EU",
- PM: "NA",
- ZM: "AF",
- EH: "AF",
- EE: "EU",
- EG: "AF",
- ZA: "AF",
- EC: "SA",
- IT: "EU",
- VN: "AS",
- SB: "OC",
- ET: "AF",
- SO: "AF",
- ZW: "AF",
- SA: "AS",
- ES: "EU",
- ER: "AF",
- ME: "EU",
- MD: "EU",
- MG: "AF",
- MF: "NA",
- MA: "AF",
- MC: "EU",
- UZ: "AS",
- MM: "AS",
- ML: "AF",
- MO: "AS",
- MN: "AS",
- MH: "OC",
- MK: "EU",
- MU: "AF",
- MT: "EU",
- MW: "AF",
- MV: "AS",
- MQ: "NA",
- MP: "OC",
- MS: "NA",
- MR: "AF",
- IM: "EU",
- UG: "AF",
- TZ: "AF",
- MY: "AS",
- MX: "NA",
- IL: "AS",
- FR: "EU",
- IO: "AS",
- SH: "AF",
- FI: "EU",
- FJ: "OC",
- FK: "SA",
- FM: "OC",
- FO: "EU",
- NI: "NA",
- NL: "EU",
- NO: "EU",
- NA: "AF",
- VU: "OC",
- NC: "OC",
- NE: "AF",
- NF: "OC",
- NG: "AF",
- NZ: "OC",
- NP: "AS",
- NR: "OC",
- NU: "OC",
- CK: "OC",
- XK: "EU",
- CI: "AF",
- CH: "EU",
- CO: "SA",
- CN: "AS",
- CM: "AF",
- CL: "SA",
- CC: "AS",
- CA: "NA",
- CG: "AF",
- CF: "AF",
- CD: "AF",
- CZ: "EU",
- CY: "EU",
- CX: "AS",
- CR: "NA",
- CW: "NA",
- CV: "AF",
- CU: "NA",
- SZ: "AF",
- SY: "AS",
- SX: "NA",
- KG: "AS",
- KE: "AF",
- SS: "AF",
- SR: "SA",
- KI: "OC",
- KH: "AS",
- KN: "NA",
- KM: "AF",
- ST: "AF",
- SK: "EU",
- KR: "AS",
- SI: "EU",
- KP: "AS",
- KW: "AS",
- SN: "AF",
- SM: "EU",
- SL: "AF",
- SC: "AF",
- KZ: "AS",
- KY: "NA",
- SG: "AS",
- SE: "EU",
- SD: "AF",
- DO: "NA",
- DM: "NA",
- DJ: "AF",
- DK: "EU",
- VG: "NA",
- DE: "EU",
- YE: "AS",
- DZ: "AF",
- US: "NA",
- UY: "SA",
- YT: "AF",
- UM: "OC",
- LB: "AS",
- LC: "NA",
- LA: "AS",
- TV: "OC",
- TW: "AS",
- TT: "NA",
- TR: "AS",
- LK: "AS",
- LI: "EU",
- LV: "EU",
- TO: "OC",
- LT: "EU",
- LU: "EU",
- LR: "AF",
- LS: "AF",
- TH: "AS",
- TF: "AN",
- TG: "AF",
- TD: "AF",
- TC: "NA",
- LY: "AF",
- VA: "EU",
- VC: "NA",
- AE: "AS",
- AD: "EU",
- AG: "NA",
- AF: "AS",
- AI: "NA",
- VI: "NA",
- IS: "EU",
- IR: "AS",
- AM: "AS",
- AL: "EU",
- AO: "AF",
- AQ: "AN",
- AS: "OC",
- AR: "SA",
- AU: "OC",
- AT: "EU",
- AW: "NA",
- IN: "AS",
- AX: "EU",
- AZ: "AS",
- IE: "EU",
- ID: "AS",
- UA: "EU",
- QA: "AS",
- MZ: "AF"
- }[e.countryCode])
- }.bind(this), "jsonp")
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor(t) {
- this.game = t, this.focused = !1, this.init()
- }
- init() {
- $("#chatInput").ready(function() {
- document.getElementById("chatInput").onblur = function() {
- this.focused = !1
- }.bind(this), document.getElementById("chatInput").onfocus = function() {
- this.focused = !0
- }.bind(this)
- }.bind(this))
- }
- escape(t) {
- var e = {
- "&": "&",
- "<": "<",
- ">": ">",
- '"': """,
- "'": "'",
- "/": "/"
- };
- return String(t).replace(/[&<>"'\/]/g, function(t) {
- return e[t]
- })
- }
- onChat(t) {
- var e = $(".chatMessages")[0],
- s = e.scrollHeight - e.clientHeight <= e.scrollTop + 1;
- $(".chatMessages").append(`<li class='chatItem'><span class='chatName' style="color: rgb(${t.color.r}, ${t.color.g}, ${t.color.b})">${this.escape(t.name)}:</span><span class='chatMsg'>${this.escape(t.msg)}</span></li>`), $(".chatMessages").scrollTop($(".chatMessages").height()), s && (e.scrollTop = e.scrollHeight - e.clientHeight)
- }
- sendChat(t) {
- this.game.socket.sendChat(t)
- }
- }
- }, function(t, e, s) {
- t.exports = class {
- constructor() {
- this.game = game, this.panels = {
- HotkeyPanel: new(s(1))(game),
- LanguagePanel: new(s(0))(game)
- }, this.init()
- }
- init() {
- console.log(this.panels)
- }
- showPanel(t) {
- this.panels[t] && this.panels[t].show()
- }
- }
- }, function(t, e) {
- class s {
- static getCanvas(t, e) {
- const s = document.createElement("canvas");
- return t && (s.width = t), e && (s.height = e), s
- }
- static getContext(t, e) {
- return this.getCanvas(t, e).getContext("2d")
- }
- static mesureText(t, e, s) {
- return this.element || this.createMesuringDiv(), this.element.textContent = t, this.element.style.font = e, this.element.style.strokeWidth = s, {
- height: this.element.clientHeight + 1,
- width: this.element.clientWidth + 1
- }
- }
- static isFontLoaded(t) {
- this.element || this.createMesuringDiv();
- const e = `${t.slice(0,t.lastIndexOf(" "))} FAKEFONTLOOL`;
- this.element.style.font = t;
- const s = this.mesureText("TESTTEXTTT X").width;
- return this.element.style.font = e, s !== this.mesureText("TESTTEXTTT X").width
- }
- static createMesuringDiv() {
- this.element = document.createElement("div"), this.element.id = "text-util-abc", this.element.style.position = "absolute", this.element.style.visibility = "hidden", this.element.style.height = "auto", this.element.style.width = "auto", this.element.style["white-space"] = "nowrap", document.body.appendChild(this.element)
- }
- }
- class i {
- constructor({
- text: t = "",
- fontSetting: e,
- fillStyle: s,
- strokeStyle: i,
- strokeSize: n
- }) {
- this.text = t, this.fontSetting = e, this.fillStyle = s, this.strokeStyle = i, this.strokeSize = n, this.width = 0, this.height = 0, this.caches = [], this.fontLoaded = !1
- }
- mesureText() {
- const t = this.getFontSetting(100),
- e = 100 * this.strokeSize,
- {
- width: i,
- height: n
- } = s.mesureText(this.text, t, e);
- return {
- width: i / 100,
- height: n / 100
- }
- }
- getFontSetting(t) {
- return this.fontSetting.replace("{pt}", t)
- }
- getLevel(t) {
- return Math.round(Math.sqrt(t) / 2)
- }
- getSize(t) {
- return (2 * (t + .5)) ** 2
- }
- isFontLoaded() {
- if (this.fontLoaded) return !0;
- return !!s.isFontLoaded(this.getFontSetting(100)) && (this.fontLoaded = !0, !0)
- }
- getCache(t) {
- if (!this.isFontLoaded()) return s.getCanvas(10, 10);
- if (!this.width && !this.height) {
- const {
- width: t,
- height: e
- } = this.mesureText();
- this.width = t, this.height = e
- }
- const e = this.getLevel(t);
- if (!this.caches[e]) {
- const t = this.generateCache(e);
- this.caches[e] = t
- }
- return this.caches[e]
- }
- findLarger(t) {
- return this.caches.find((e, s) => s > t)
- }
- generateCache(t) {
- "xAz" === this.text && console.log(t);
- const e = this.getSize(t),
- i = e * this.width + 10,
- n = e * this.height + 10,
- o = s.getContext(i, n),
- a = this.findLarger(t);
- return a ? o.drawImage(a, 0, 0, i, n) : (o.font = this.getFontSetting(e), o.fillStyle = this.fillStyle, o.strokeStyle = this.strokeStyle, o.lineWidth = e * this.strokeSize, o.textBaseline = "middle", o.textAlign = "center", this.strokeSize && o.strokeText(this.text, i / 2, n / 2), o.fillText(this.text, i / 2, n / 2)), o.canvas
- }
- }
- t.exports = {
- Cache: class {
- constructor(t) {
- this.caches = new Map, this.cacheSettings = Object.assign({
- fontSetting: "500 {pt}pt Ubuntu",
- fillStyle: "#fff",
- strokeStyle: "#000",
- strokeSize: .1
- }, t), this.cleanInterval = setInterval(() => this.clean(), 3e4)
- }
- getCache(t) {
- if (!this.caches.get(t)) {
- const e = new i({ ...this.cacheSettings,
- text: t
- });
- this.caches.set(t, e)
- }
- const e = this.caches.get(t);
- return e.updateTime = Date.now(), e
- }
- clean() {
- this.caches.forEach((t, e) => {
- e.updateTime < Date.now() - 12e4 && this.caches.delete(t)
- })
- }
- },
- Text: i,
- CanvasUtils: s
- }
- }, function(t, e) {
- t.exports = class {
- constructor(t) {
- this.game = t, this.settings = {}, this.settingsConf = JSON.parse(localStorage.getItem("settingsConf")) || {}, this.domQueue = [], this.init()
- }
- init() {
- this.loadSettings(), this.loadEvents()
- }
- handleDomQueue() {
- for (var t in this.domQueue) $(this.domQueue[t].id).val(this.domQueue[t].val)
- }
- loadEvents() {
- var t = ["noSkins", "noNames", "darkTheme", "showMass", "smoothRender", "hideChat"];
- for (var e in t) $("#" + t[e]).click(this.toggleCheckBox.bind(this, t[e]))
- }
- toggleCheckBox(t) {
- let e = document.getElementById(t).checked;
- switch (this.set(t, e, "checkbox"), t) {
- case "hideChat":
- 1 == e ? $("#chatbox").hide() : $("#chatbox").show()
- }
- }
- loadSettings() {
- for (var t in this.settingsConf) {
- this.settings[t] = this.get(t);
- var e = this.settingsConf[t];
- "input" == e.type && (this.domQueue.push({
- id: `#${t}`,
- val: this.settings[t]
- }), console.log(this.settings[t], `#${t}`)), "checkbox" == e.type && (document.getElementById(t).checked = this.settings[t], this.toggleCheckBox(t))
- }
- }
- get(t) {
- if (this.settings[t]) return this.settings[t]; {
- let e = localStorage.getItem(t);
- if (!e) return null;
- try {
- return JSON.parse(e)
- } catch (t) {
- return e
- }
- }
- }
- set(t, e, s) {
- this.settings[t] = e, this.settingsConf[t] = {
- type: s
- }, localStorage.setItem(t, e), localStorage.setItem("settingsConf", JSON.stringify(this.settingsConf))
- }
- remove(t) {
- delete this.settings[t], delete this.settingsConf[t], localStorage.removeItem(t), localStorage.setItem("settingsConf", JSON.stringify(this.settingsConf))
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor(t) {
- this.game = t, this.hotkeys = {
- split: {
- key: t.settings.get("split") || 32,
- type: "simple",
- name: "Split",
- handler: function() {
- t.socket.split()
- }
- },
- doubleSplit: {
- key: t.settings.get("doubleSplit") || 81,
- type: "simple",
- name: "Double Split",
- handler: function() {
- t.socket.split(), setTimeout(function() {
- t.socket.split()
- }.bind(this), 40)
- }
- },
- x16: {
- key: t.settings.get("x16") || 84,
- type: "simple",
- name: "16 Split",
- handler: function() {
- t.socket.split(), setTimeout(function() {
- t.socket.split()
- }.bind(this), 40), setTimeout(function() {
- t.socket.split()
- }.bind(this), 80), setTimeout(function() {
- t.socket.split()
- }.bind(this), 120)
- }
- },
- feedMacro: {
- key: t.settings.get("feedMacro") || 87,
- type: "continuous",
- name: "Feed",
- interval: 100,
- handler: function() {
- t.socket.eject()
- }
- },
- esc: {
- key: 27,
- type: "simple",
- custom: !1,
- handler: function() {
- $(".menu").show()
- }
- },
- sendChat: {
- key: 13,
- type: "simple",
- custom: !1,
- chatFocus: !0,
- handler: function() {
- console.log("test"), t.chat.focused ? (console.log(t.chat.focused), t.socket.sendChat($("#chatInput").val()), $("#chatInput").val("").blur()) : ($("#chatInput").focus(), t.chat.focused = !0)
- }
- },
- spectate: {
- key: 81,
- type: "simple",
- custom: !1,
- handler: function() {
- t.socket.send(new Uint8Array([18]))
- }
- }
- }, this.init()
- }
- init() {
- window.addEventListener("keydown", this.onKeyDown.bind(this)), window.addEventListener("keyup", this.onKeyUp.bind(this)), $("#hotkeyModal").ready(function() {
- for (var t in this.hotkeys) {
- let s = this.hotkeys[t];
- if (void 0 == this.hotkeys[t].custom) {
- $("#hotkeysModalBody").append(`<div id="hotkeySection"> <div class="hotkeyName"> <p class="hotkeyTrigger">${s.name}</p> </div> <div class="hotkeyCode"> <input class="form-control key" id="hotkey${t}" type="text" value="${this.getPressedKey({keyCode:s.key})}"> </div> </div>`);
- var e = this;
- $(`#hotkey${t}`).keydown(function(t) {
- e.handleKey(this.id.split("hotkey")[1], this, t)
- })
- }
- }
- $("#btnHotkeysClose").click(function() {
- return $("#hotkeysModal").removeClass("bouncein"), $("#hotkeysModal").addClass("bounceout"), setTimeout(function() {
- $("#hotkeysModal").removeClass("bounceout")
- }, 500), !1
- }.bind(this)), $(".btnControls").click(function() {
- return $("#hotkeysModal").removeClass("bounceout"), $("#hotkeysModal").addClass("bouncein"), !1
- }.bind(this))
- }.bind(this))
- }
- onKeyDown(t) {
- for (var e in this.hotkeys) {
- let s = this.hotkeys[e];
- if (s.key == t.keyCode) {
- if (s.pressed) return;
- if (this.game.chat.focused && !s.chatFocus) return;
- s.handler(), "continuous" == s.type && (s.keyInterval = setInterval(function() {
- s.handler()
- }.bind(this), s.interval || 120)), s.pressed = !0
- }
- }
- }
- onKeyUp(t) {
- for (var e in this.hotkeys) {
- let s = this.hotkeys[e];
- s.key == t.keyCode && (s.pressed = !1, "continuous" == s.type && clearInterval(s.keyInterval))
- }
- }
- handleKey(t, e, s) {
- e.value.length > 0 && (e.value = this.getPressedKey(s), s.preventDefault()), this.game.settings.set(e.id, this.getPressedKey(s), "input"), this.hotkeys[t].key = s.keyCode, this.game.settings.set(e.id.split("hotkey")[1], s.keyCode, "value")
- }
- getPressedKey(t) {
- var e = "";
- return 8 == t.keyCode || 46 == t.keyCode ? e += "" : 9 == t.keyCode ? e += "TAB" : 16 == t.keyCode ? e += "SHIFT" : 32 == t.keyCode ? e += "SPACE" : e += String.fromCharCode(t.keyCode), e
- }
- }
- }, function(t, e) {
- t.exports = class {
- constructor(t) {
- this.game = t, this.canvas = null, this.ctx = null, this.camera = {
- oldX: 0,
- oldY: 0,
- x: 0,
- y: 0,
- newX: 0,
- newY: 0
- }, this.zoom = .6, this.newZoom = .6, this.wheelZoom = 1, this.mouse = {
- rawX: 0,
- rawY: 0,
- x: 0,
- y: 0
- }, this.maxScore = 0, this.scenes = [], this.fps = 0, this.fpsTimes = []
- }
- init() {
- this.canvas = document.getElementById("canvas"), this.ctx = this.canvas.getContext("2d"), this.canvas.width = window.innerWidth, this.canvas.height = window.innerHeight, window.addEventListener("resize", () => {
- this.canvas.width = window.innerWidth, this.canvas.height = window.innerHeight
- }), window.addEventListener("wheel", function(t) {
- t.deltaY < 0 && (this.wheelZoom += this.wheelZoom / 15), t.deltaY > 0 && (this.wheelZoom -= this.wheelZoom / 15)
- }.bind(this)), this.canvas.onmousemove = this.onMouseMove.bind(this), setInterval(function() {
- "DISCONNECTED" !== this.game.socket.state && this.sendMouseMove()
- }.bind(this), 100), requestAnimationFrame(this.drawGame.bind(this))
- }
- onMouseMove(t) {
- this.mouse.rawX = t.clientX, this.mouse.rawY = t.clientY
- }
- sendMouseMove() {
- this.mouse.x = (this.mouse.rawX - this.canvas.width / 2) / this.newZoom + this.camera.x, this.mouse.y = (this.mouse.rawY - this.canvas.height / 2) / this.newZoom + this.camera.y, this.game.socket.move(this.mouse.x, this.mouse.y)
- }
- drawGrid() {
- this.ctx.fillStyle = this.game.settings.get("darkTheme") ? "#111111" : "#F2FBFF", this.ctx.lineWidth = 1, this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height), this.ctx.save(), this.ctx.strokeStyle = this.game.settings.get("darkTheme") ? "#AAAAAA" : "#000000", this.ctx.globalAlpha = .2, this.ctx.scale(this.newZoom, this.newZoom);
- for (var t = this.canvas.width / this.newZoom, e = this.canvas.height / this.newZoom, s = (-this.camera.x + t / 2) % 50 - .5; s < t; s += 50) this.ctx.moveTo(s, 0), this.ctx.lineTo(s, e);
- for (this.ctx.stroke(), this.ctx.beginPath(), s = (-this.camera.y + e / 2) % 50 - .5; s < e; s += 50) this.ctx.moveTo(0, s), this.ctx.lineTo(t, s);
- this.ctx.stroke(), this.ctx.restore()
- }
- lerp(t, e, s) {
- return (1 - s) * t + s * e
- }
- updateViewPort() {
- var t = {};
- for (var e in this.game.playerCells) 0 !== this.game.playerCells[e] && (t[e] = this.game.playerCells[e]);
- if (Object.keys(t).length > 0) {
- var s = 0,
- i = 0;
- for (var e in t) t[e].updatePos(), s += t[e].x / Object.keys(t).length, i += t[e].y / Object.keys(t).length;
- s = (this.camera.x + s) / 2, i = (this.camera.y + i) / 2, this.camera = {
- x: s,
- y: i
- }, this.zoom = this.getViewZoom()
- }
- }
- getViewZoom() {
- var t = 0,
- e = this;
- for (var s in this.game.playerCells) this.game.playerCells[s] && (t += this.game.playerCells[s].size);
- return t = Math.pow(Math.min(64 / t, 1), .4) * (Math.max(e.canvas.height / 1080, e.canvas.width / 1920) * e.wheelZoom)
- }
- clearCanvas() {
- this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height)
- }
- drawGame() {
- var t = Date.now();
- game.timestamp = t;
- const e = performance.now();
- for (; this.fpsTimes.length > 0 && this.fpsTimes[0] <= e - 1e3;) this.fpsTimes.shift();
- this.fpsTimes.push(e), this.fps = this.fpsTimes.length, this.updateViewPort();
- let s = 0;
- for (var i in this.game.playerCells) 0 !== (o = this.game.playerCells[i]) && (s += o.size * o.size / 100);
- s > this.maxScore && (this.maxScore = s, $("#score").text("Score: " + Math.round(s))), this.ctx.setTransform(1, 0, 0, 1, 0, 0), this.clearCanvas(), this.drawGrid(), this.newZoom = this.lerp(this.newZoom, this.zoom, .1), this.ctx.translate(this.canvas.width / 2, this.canvas.height / 2), this.ctx.scale(this.newZoom, this.newZoom), this.ctx.translate(-this.camera.x, -this.camera.y);
- var n = Object.keys(game.cells).sort(function(t, e) {
- return game.cells[t].size - game.cells[e].size
- });
- for (var i in n) {
- var o;
- (o = this.game.cells[n[i]]).render(this.ctx)
- }
- window.stopCanvas || requestAnimationFrame(this.drawGame.bind(this))
- }
- }
- }, function(t, e) {
- t.exports = function(t, e) {
- function s() {
- for (var e = ""; 0 !== (char = t.getUint16(i, !0));) e += String.fromCharCode(char), i += 2;
- return i += 2, e
- }
- var i = 1,
- n = (t.getUint8(i++), {
- r: t.getUint8(i++),
- g: t.getUint8(i++),
- b: t.getUint8(i++)
- }),
- o = {
- name: s(),
- msg: s(),
- color: n
- };
- e.game.chat.onChat(o)
- }
- }, function(t, e) {
- t.exports = function(t, e) {
- e.game.map.minX = t.getFloat64(1, !0), e.game.map.minY = t.getFloat64(9, !0), e.game.map.maxX = t.getFloat64(17, !0), e.game.map.maxY = t.getFloat64(25, !0), Object.keys(game.playerCells).length
- }
- }, function(t, e) {
- t.exports = function(t, e) {
- let s = 1;
- var i = [],
- n = t.getUint32(s, !0);
- s += 4;
- for (var o = 0; o < n; o++) {
- var a = t.getUint32(s, !0);
- s += 4;
- for (var h, l = ""; h = t.getUint16(s, !0), s += 2, 0 != h;) l += String.fromCharCode(h);
- i.push({
- name: l,
- id: a
- })
- }
- game.leaderboard = i, game.drawLeaderboard()
- }
- }, function(t, e) {
- t.exports = function(t, e) {
- let s = e.game;
- var i = t.getUint32(1, !0);
- s.ownedCells.push(i), 1 == Object.keys(s.playerCells).length && (e.state = "SPAWNED")
- }
- }, function(t, e) {
- t.exports = function(t, e) {
- var s = e.game.scene;
- s.camera.x = s.lerp(s.camera.x, t.getFloat32(1, !0), .05), s.camera.y = s.lerp(s.camera.y, t.getFloat32(5, !0), .05), s.zoom = t.getFloat32(9, !0) * s.wheelZoom, game.socket.state = "SPECTATING"
- }
- }, function(t, e) {
- window.pelletCache = {};
- var s = ["073CFF", "FF076E", "07FF9B", "07E0FF", "9E07FF", "FF0E07", "FF7C07"],
- i = new Image;
- i.src = "virus.png";
- var n = new Image;
- n.src = "mothercell.png";
- t.exports = class {
- constructor(t, e, s, i, n) {
- this.id = t, this.oldX = this.x = e, this.oldY = this.y = s, this.newX = 0, this.newY = 0, this.oldSize = this.size = i, this.newSize = 0, this.color = "", this.pelletColor = "", this.name = "", this.isVirus = !1, this.isPellet = !1, this.updateTime = 0, this.game = n, this.nameCache = null, this.extras = {}
- }
- updatePos() {
- var t, e = 0 > (t = 0 > (t = (this.game.timestamp - this.updateTime) / 120) ? 0 : 1 < t ? 1 : t) ? 0 : 1 < t ? 1 : t;
- return this.x = t * (this.newX - this.oldX) + this.oldX, this.y = t * (this.newY - this.oldY) + this.oldY, this.size = e * (this.newSize - this.oldSize) + this.oldSize, e
- }
- setName(t) {
- this.name || (this.name = t, this.nameCache = this.game.nameCache.getCache(t))
- }
- getStrokeStyle() {
- var t = (~~(.9 * parseInt(this.color.substr(1, 2), 16))).toString(16),
- e = (~~(.9 * parseInt(this.color.substr(3, 2), 16))).toString(16),
- s = (~~(.9 * parseInt(this.color.substr(5, 2), 16))).toString(16);
- return 1 == t.length && (t = "0" + t), 1 == e.length && (e = "0" + e), 1 == s.length && (s = "0" + s), "#" + t + e + s
- }
- render(t) {
- if (this.updatePos(), this.isVirus) {
- var e = 2 * this.size + 5,
- s = i;
- return "#ce6363" == this.color && (s = n), void t.drawImage(s, this.x - e / 2, this.y - e / 2, e, e)
- }
- if (this.size < 15) return this.isPellet = !0, void this.renderPellet(t);
- t.beginPath(), t.lineWidth = .03 * this.size, t.lineCap = "round", t.fillStyle = this.color, t.strokeStyle = this.getStrokeStyle(), t.arc(this.x, this.y, this.size + 5, 0, 2 * Math.PI), t.fill(), t.stroke(), this.extras.skin && !this.game.settings.get("noSkins") && (this.game.skinCache[this.extras.skin] || (this.game.skinCache[this.extras.skin] = new Image, this.game.skinCache[this.extras.skin].src = "http://cellz.io/skins/" + this.extras.skin + ".png"), t.save(), t.clip(), t.drawImage(this.game.skinCache[this.extras.skin], this.x - this.size, this.y - this.size, 2 * this.size, 2 * this.size), t.restore());
- var o = !0;
- this.extras.pID && this.game.players[this.extras.pID].sorted.indexOf(this.id.toString()) > 3 && (o = !1);
- let a = 0;
- if (this.name && !this.game.settings.get("noNames") && o) {
- const e = this.game.scene.newZoom,
- s = .25 * this.size,
- i = this.nameCache.getCache(s * e),
- n = this.nameCache.width * s,
- o = this.nameCache.height * s;
- t.drawImage(i, this.x - n / 2, this.y - o / 2, n, o), a = o
- }
- if (this.game.settings.get("showMass") && this.size > 60 && o) {
- const e = this.game.scene.newZoom,
- s = .25 * this.size;
- let i = this.getMassText();
- this.game.massCache[i] || (this.game.massCache[i] = this.game.nameCache.getCache(i));
- let n = this.game.massCache[i].getCache(s * e);
- const o = this.game.massCache[i].width * s,
- h = this.game.massCache[i].height * s;
- t.drawImage(n, this.x - o / 2, this.y + a - h / 1.2, o, h)
- }
- t.closePath()
- }
- getMassText() {
- var t = this.size * this.size / 100;
- return t >= 1e3 ? (t / 1e3).toFixed(1) + "k" : (6 * Math.round(t / 6)).toString()
- }
- renderPellet(t) {
- var e = this.getPellet();
- e && (t.beginPath(), t.drawImage(e, this.x, this.y, e.width, e.height), t.closePath())
- }
- getPellet() {
- this.pelletColor || (this.pelletColor = "#" + s[Math.floor(Math.random() * s.length)]);
- var t = this.pelletColor;
- if (pelletCache[t]) return pelletCache[t];
- var e = document.createElement("canvas");
- e.width = this.size + 15, e.height = this.size + 15;
- var i = e.getContext("2d");
- return i.beginPath(), console.log(t), i.fillStyle = t, i.arc(e.width / 2, e.height / 2, this.size, 0, 2 * Math.PI), i.fill(), i.closePath(), pelletCache[t] = e, pelletCache[e]
- }
- destroy() {
- if (this.game.playerCells.hasOwnProperty(this.id) && delete this.game.playerCells[this.id], this.extras.pID && this.game.players[this.extras.pID]) {
- delete this.game.players[this.extras.pID][this.id];
- var t = Object.keys(this.game.players[this.extras.pID]);
- t.splice(t.indexOf("sorted"), 1), game.players[this.extras.pID].sorted = t.sort(function(t, e) {
- return game.players[this.extras.pID][e].size - game.players[this.extras.pID][t].size
- }.bind(this))
- }
- var e = game.ownedCells.indexOf(this.id); - 1 != e && game.ownedCells.splice(e, 1), delete this.game.cells[this.id]
- }
- }
- }, function(t, e, s) {
- const i = s(33);
- t.exports = function(t, e) {
- let s = 1,
- n = e.game;
- n.timestamp = Date.now();
- const o = t.getUint16(s, !0);
- s += 2;
- for (var a = 0; a < o; a++) {
- t.getUint32(s, !0);
- var h = t.getUint32(s + 4, !0);
- s += 8, n.cells[h].destroy()
- }
- for (;;) {
- let e = t.getUint32(s, !0);
- if (s += 4, 0 == e) break;
- let o = t.getInt32(s, !0);
- s += 4;
- let h = t.getInt32(s, !0);
- s += 4;
- let p = t.getInt16(s, !0);
- s += 2;
- let g = null;
- n.cells.hasOwnProperty(e) && 0 !== n.cells[e] ? ((g = n.cells[e]).updatePos(), g.oldX = g.x, g.oldY = g.y, g.oldSize = g.size) : (g = new i(e, o, h, p, n), n.cells[e] = g), g.newX = o, g.newY = h, g.newSize = p, g.updateTime = Date.now();
- for (var l = (t.getUint8(s++) << 16 | t.getUint8(s++) << 8 | t.getUint8(s++)).toString(16); 6 > l.length;) l = "0" + l;
- g.color = "#" + l;
- const m = t.getUint8(s++);
- 1 & m && (g.isVirus = !0);
- var r, c = "";
- if (4 & m)
- for (;;) {
- const e = t.getUint16(s, !0);
- if (s += 2, 0 == e) break;
- c += String.fromCharCode(e)
- }
- if (c) try {
- var d = JSON.parse(c);
- g.extras = d, d && d.pID && (n.players[d.pID] || (n.players[d.pID] = {
- sorted: []
- }), n.players[d.pID][g.id] = g, (r = Object.keys(n.players[d.pID])).splice(r.indexOf("sorted"), 1), n.players[d.pID].sorted = r.sort(function(t, e) {
- return n.players[d.pID][e].size - n.players[d.pID][t].size
- }))
- } catch (t) {}
- if (g.extras.pID) d = g.extras, (r = Object.keys(n.players[d.pID])).splice(r.indexOf("sorted"), 1), n.players[d.pID].sorted = r.sort(function(t, e) {
- return n.players[d.pID][e].size - n.players[d.pID][t].size
- });
- let f = [];
- for (;;) {
- const e = t.getUint16(s, !0);
- if (s += 2, 0 == e) break;
- f.push(e)
- }
- var u = "";
- for (var a in f) u += String.fromCharCode(f[a]);
- g.setName(u), !n.playerCells[e] && n.ownedCells.indexOf(e) >= 0 && (n.playerCells[e] = g, g && (n.playerId = g.extras.pID))
- }
- const p = t.getUint32(s, !0);
- s += 4;
- for (let e = 0; e < p; e++) {
- const e = t.getUint32(s, !0);
- s += 4, n.cells[e] && n.cells[e].destroy()
- }
- 0 == n.cellsLength() && "SPAWNED" == n.socket.state && (n.onDeath(), n.socket.state = "DEAD")
- }
- }, function(t, e, s) {
- let i = new Uint8Array([254, 5, 0, 0, 0]),
- n = new Uint8Array([255, 0, 0, 0, 0]),
- o = new Uint8Array([17]),
- a = new Uint8Array([21]),
- h = {
- 16: s(34),
- 17: s(32),
- 18: function(t, e) {
- var s = e.game;
- s.playerCells = {}, s.cells = {}
- },
- 20: function(t, e) {
- e.game.playerCells = {}
- },
- 32: s(31),
- 49: s(30),
- 64: s(29),
- 99: s(28)
- };
- t.exports = class {
- constructor(t) {
- this.game = t, this.ws = null, this.state = "STARTING", this.jwt = "", this.ip = "", this.skin = this.game.settings.get("selectedSkin") || ""
- }
- connect(t) {
- this.ws && (this.ws.onopen = null, this.ws.onmessage = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.close()), this.ws = new WebSocket(t), this.ip = t, this.ws.binaryType = "arraybuffer", this.ws.onopen = this.onOpen.bind(this), this.ws.onmessage = this.onMessage.bind(this), this.ws.onerror = this.onError.bind(this), this.ws.onclose = this.onClose.bind(this)
- }
- onOpen() {
- console.log("Connection Opened!"), this.state = "CONNECTED", this.sendInitKeys(), this.ws.wasConnected = !0
- }
- sendInitKeys() {
- this.send(i), this.send(n), this.sendVerifyToken(), this.jwt && this.sendJWT()
- }
- onClose(t) {
- console.log("Connection Closed!", t.reason), this.state = "DISCONNECTED", this.ws.wasConnected && this.game.onDeath(), this.connect(this.ip)
- }
- onError() {}
- onMessage(t) {
- let e = new DataView(t.data),
- s = e.getUint8(0);
- h[s] && h[s](e, this)
- }
- sendVerifyToken() {
- let t = this.game.verifyToken;
- console.log(t);
- var e = new DataView(new ArrayBuffer(2 + t.length));
- e.setUint8(0, 32);
- for (var s = 0; s < t.length; s++) e.setUint8(s + 1, t.charCodeAt(s));
- this.send(e)
- }
- sendJWT(t) {
- var e = new DataView(new ArrayBuffer(2 + this.jwt.length));
- e.setUint8(0, 30);
- for (var s = 0; s < this.jwt.length; s++) e.setUint8(s + 1, this.jwt.charCodeAt(s));
- this.send(e)
- }
- split() {
- this.send(o)
- }
- eject() {
- this.send(a)
- }
- sendNick(t) {
- console.log(t);
- const e = JSON.stringify({
- name: t || "Cellz.io",
- skin: this.skin
- }),
- s = new DataView(new ArrayBuffer(1 + 2 * e.length));
- s.setUint8(0, 0);
- for (let t = 0; t < e.length; t++) s.setUint16(1 + 2 * t, e.charCodeAt(t), !0);
- this.state = "SPAWNING", this.send(s)
- }
- move(t, e) {
- const s = new DataView(new ArrayBuffer(13));
- s.setUint8(0, 16), s.setInt32(1, t, !0), s.setInt32(5, e, !0), s.setUint32(9, 0), this.send(new Uint8Array(s.buffer))
- }
- sendChat(t) {
- var e = new DataView(new ArrayBuffer(2 + 2 * t.length)),
- s = 0;
- e.setUint8(s++, 99), e.setUint8(s++, 0);
- for (var i = 0; i < t.length; ++i) e.setUint16(s, t.charCodeAt(i), !0), s += 2;
- this.send(e)
- }
- send(t) {
- this.ws && this.ws.readyState === WebSocket.OPEN && this.ws.send(t)
- }
- }
- }, function(t, e, s) {
- const i = s(35),
- n = s(27),
- o = s(26),
- a = s(25),
- h = s(24),
- l = s(23),
- r = s(0),
- c = (s(1), s(22)),
- d = s(21),
- u = s(19),
- p = s(18),
- g = s(17);
- s(7);
- window.game = new class {
- constructor() {
- this.cookie = new p, this.settings = new a(this), this.socket = new i(this), this.scene = new n(this), this.hotkeys = new o(this), this.languages = new r, this.panelHandler = new l(this), this.chat = new c(this), this.servers = new d(this), this.nameCache = new h.Cache, this.masterServer = new u(this), this.api = new g(this), this.cells = {}, this.players = {}, this.playerCells = {}, this.ownedCells = [], this.skinCache = {}, this.playerId = 0, this.leaderboard = [], this.nick = "", this.timestamp = 0, this.verifyToken = "", this.map = {
- minX: 0,
- minY: 0,
- maxX: 0,
- maxY: 0
- }, this.massCache = {}
- }
- async initApp() {
- this.verifyToken = await this.getVerifyToken(), this.servers.init(), this.scene.init(), this.settings.get("shownUpdatePanel") || ($(".updateButton").click(function() {
- $(".updateModal").fadeOut(1500)
- }), $(".updateModal").addClass("isActive").fadeIn(1500), this.settings.set("shownUpdatePanel", !0, "val")), $(document.body).ready(function() {
- window.onresize = function() {
- this.resizeScreen()
- }.bind(this), this.resizeScreen(), this.settings.handleDomQueue(), $("#settings").click(function() {
- this.toggleSettings()
- }.bind(this)), $("#spectate").click(function() {
- this.spectate()
- }.bind(this)), $("#login").click(function() {
- this.api.login()
- }.bind(this)), $("#logout").click(function() {
- this.api.logout()
- }.bind(this)), $(".btnShop").click(function() {
- this.api.shop.open()
- }.bind(this)), $(".btnLanguages").click(function() {
- this.languages.openPanel()
- }.bind(this)), $("#btnLanguagesClose").click(function() {
- this.languages.closePanel()
- }.bind(this)), $(".updateText").text(getText("Hello Cellz.io Player & welcome to the new Cellz.io! Cellz.io has had a major update!")), $(".secondText").text(getText("We have remade the Cellz.io client from scratch, we would like you to help us find any problems witth the new client and report them back to us!")), $(".noteText").text(getText("Note: If you find any bugs/glitches, please report them in the discord!"))
- }.bind(this))
- }
- resizeScreen() {
- innerWidth > 1174 && (document.getElementsByClassName("container")[0].style["margin-left"] = "");
- for (var t = 100 * parseFloat(window.innerHeight / 974), e = -119.5, s = 15.5, i = 100 * Math.round(innerWidth / 100), n = 0; n < i / 100; n++) e += s, s -= 1 - .004 * n;
- var o = e;
- innerWidth !== i && (o += (innerWidth - i) * (s / 100)), document.getElementsByClassName("container")[0].style.transform = `scale(${innerHeight/974}, ${innerHeight/974})`;
- var a = 0;
- innerHeight > 858 && (a = .003 * innerHeight), document.getElementsByClassName("container")[0].style["margin-top"] = `${.02*innerHeight-17.26-a}%`, innerWidth < 1174 && (document.getElementsByClassName("container")[0].style["margin-left"] = `${o}%`);
- var h = .007;
- innerHeight < 350 && (h = .005), innerHeight > 560 && (h = .0049), document.getElementById("adsTop").style["margin-top"] = `${innerHeight*h+(-2.45-500*h)}%`, document.getElementById("adsBottom").style["margin-bottom"] = `${innerHeight*h+(-2.45-500*h)}%`, document.getElementById("adsBottom").style.transform = `scale(${innerHeight/974},${innerHeight/974})`, document.getElementById("adsTop").style.transform = `scale(${innerHeight/974},${innerHeight/974})`, document.getElementsByClassName("infoBox")[0].style.zoom = `${t}%`, document.getElementById("languagesModal").style.zoom = `${t}%`, document.getElementById("hotkeysModal").style.zoom = `${t}%`, document.getElementsByClassName("infoBox")[0].style.zoom = `${t}%`, document.getElementById("shopModal").style.zoom = `${t}%`, document.getElementsByClassName("continuePanel")[0].style.transform = `scale(${innerHeight/974}, ${innerHeight/974})`, window.innerWidth <= 750 ? $(".ended").css({
- left: "-46%"
- }) : window.innerWidth <= 800 ? $(".ended").css({
- left: "-44%"
- }) : window.innerWidth <= 850 ? $(".ended").css({
- left: "-42%"
- }) : window.innerWidth <= 900 ? $(".ended").css({
- left: "-40%"
- }) : window.innerWidth <= 950 ? $(".ended").css({
- left: "-38%"
- }) : window.innerWidth <= 1100 ? $(".ended").css({
- left: "-36%"
- }) : window.innerWidth <= 1250 ? $(".ended").css({
- left: "-30%"
- }) : window.innerWidth <= 1300 ? $(".ended").css({
- left: "-28%"
- }) : window.innerWidth <= 1350 ? $(".ended").css({
- left: "-26%"
- }) : window.innerWidth <= 1400 ? $(".ended").css({
- left: "-25%"
- }) : window.innerWidth <= 1450 ? $(".ended").css({
- left: "-24%"
- }) : window.innerWidth <= 1500 ? $(".ended").css({
- left: "-23%"
- }) : window.innerWidth <= 1550 ? $(".ended").css({
- left: "-22%"
- }) : window.innerWidth <= 1950 ? $(".ended").css({
- left: "-18%"
- }) : $(".ended").css({
- left: "0%"
- })
- }
- onDeath() {
- window.onShow(), $(".btnContinue").click(function(t) {
- $(".ended").hide(), $(".menu").show(), t.preventDefault()
- }), $("#score").css("z-index", "0"), $(".ended").fadeIn(3e3)
- }
- getVerifyToken() {
- return new Promise(function(t, e) {
- $.get("http://main.cellz.io/num", function(e) {
- var s = genKey(parseInt(e));
- console.log(s), $.get("http://main.cellz.io/token?num=" + s, function(e) {
- t(e)
- })
- })
- })
- }
- spawn() {
- $(".menu").hide(), $("#score").css("z-index", "300"), this.settings.set("nick", $("#nick").val(), "input"), this.socket.sendNick($("#nick").val())
- }
- spectate() {
- $(".menu").hide(), this.scene.zoom = .16, this.socket.send(new Uint8Array([1]))
- }
- cellsLength() {
- return Object.keys(this.playerCells).length
- }
- drawLeaderboard() {
- var t = "",
- e = !1;
- for (let i = 0; i < this.leaderboard.length; i++) {
- var s = "";
- this.playerCells[this.leaderboard[i].id] && (s = "color: #FFAAAA"), t += `<span class="pos" style="${s}">${i+1}. ${this.chat.escape(this.leaderboard[i].name)}</span>`, e = !0
- }
- e && (document.getElementById("lb").innerHTML = t)
- }
- toggleSettings() {
- var t = document.getElementById("options");
- t.style.display = "block" == t.style.display ? "none" : "block"
- }
- }, game.initApp()
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement