Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name eRepublik Stuff++
- // @author Zordacz
- // @version 5.4
- // @include https://www.erepublik.com/*
- // @run-at document-start
- // @grant none
- // ==/UserScript==
- ! function() {
- if (location.href.includes("A/u/t/o/F/i/g/h/t/e/r")) addEventListener("DOMContentLoaded", function() {
- var e = localStorage.waMLog;
- document.head.insertAdjacentHTML("beforeEnd", "<style>#autoFighter{border:0;position:absolute;width:100vw;height:100vh;z-index:999}#status{position:absolute;width:100vw;height:100vh;z-index:9999;transition:background 1s;background:#000}#status div{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);text-align:center;background:" + (!e || e.includes("FUL") ? "#83B70B" : "red") + ";color:#fff;padding:5px;font:700 14px Arial;border-radius:1px;text-shadow:0 0 2px #000;box-shadow:0 0 3px inset #000}</style>"), document.body.innerHTML = '<iframe id="autoFighter" src="/en/military/campaigns" sandbox="allow-same-origin allow-scripts allow-forms"></iframe><div id="status"><div>' + (e || "AUTOFIGHTER ON<br>click anywhere to abort") + "</div></div>", document.title = "AUTOFIGHTER ON", 0 === navigator.maxTouchPoints && setTimeout(() => document.getElementById("status").style.background = "rgba(0,0,0,.6)", 1e3), setInterval(function() {
- window.lastCheck && lastCheck + 9e5 < Date.now() && (document.getElementById("autoFighter").src = "/en/military/campaigns")
- }, 6e4), addEventListener("click", () => location.href = "/")
- });
- else if (top == self || parent.location.href.includes("A/u/t/o/F/i/g/h/t/e/r")) {
- var e = [],
- t = XMLHttpRequest.prototype.send;
- XMLHttpRequest.prototype.send = function() {
- this.addEventListener("load", function() {
- var t = "{" == this.responseText.trim()[0] ? JSON.parse(this.responseText) : this.responseText;
- for (let n of e) n(t, this.responseURL)
- }), t.apply(this, arguments)
- }, addEventListener("DOMContentLoaded", function() {
- function t(e, t) {
- for (let n in e)
- if (e.hasOwnProperty(n) && !1 === t(n, e[n])) break
- }
- function n(e, t) {
- var n = document.querySelectorAll(e);
- return t && n.forEach((e, n) => t(e, n)), n
- }
- function i(e) {
- document.head.insertAdjacentHTML("beforeEnd", "<style>" + e + "</style>")
- }
- function o(e) {
- return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
- }
- function a(e, t) {
- return e > 999999999 ? (e / 1e9).toFixed(t + 1) + "B" : e > 999999 ? (e / 1e6).toFixed(t) + "M" : o(+e.toFixed(t))
- }
- function r(e, t) {
- fetch(e, {
- credentials: "same-origin"
- }).then(e => e.text()).then(e => t && t("{" == e.trim()[0] ? JSON.parse(e) : e))
- }
- function l(e, n, i) {
- var o = "";
- t(n, (e, t) => o += "&" + encodeURIComponent(e) + "=" + encodeURIComponent(t)), fetch(e, {
- method: "POST",
- headers: {
- "Content-Type": "application/x-www-form-urlencoded"
- },
- credentials: "same-origin",
- body: o
- }).then(e => e.text()).then(e => i && i("{" == e.trim()[0] ? JSON.parse(e) : e))
- }
- function s(e, t, n) {
- function i() {
- de.style = "";
- var t = e.getBoundingClientRect(),
- n = e.gravity || "ns";
- n = "ns" == n ? t.top - de.offsetHeight - 5 < 0 ? "s" : "n" : n, de.style["w" == n ? "right" : "left"] = ("ns".includes(n) ? t.left + t.width / 2 - de.offsetWidth / 2 : "w" == n ? innerWidth - t.left - 5 : t.right + 5).toFixed() + "px", de.style["n" == n ? "bottom" : "top"] = ("ew".includes(n) ? t.top + t.height / 2 - de.offsetHeight / 2 : "n" == n ? innerHeight - t.top + 5 : t.bottom + 5).toFixed() + "px", de.style.visibility = "visible"
- }
- e.gravity = t, e.addEventListener("mouseenter", function(t) {
- var o = e.title || e.orgtitle;
- de.innerHTML = n ? n(i) : o, e.orgtitle = o, e.title = "", i()
- }), e.addEventListener("mouseleave", () => de.style = "")
- }
- function c(e) {
- r("//dl.dropboxusercontent.com/s/165fdfgga2lb3se/u.json", function(t) {
- G.update = re, 6365664 != V && (!G.sub || G.sub < re - 30) && (G.sub = re, l("/" + q + "/main/newspaper-subscribe", {
- _token: csrfToken,
- action: "subscribe",
- newspaperId: 287990
- })), Object.assign(G, t), C(), L(), e ? p() : d()
- })
- }
- function d() {
- localStorage.stuff = JSON.stringify(G)
- }
- function p() {
- ee = [0, 0, 0, 0], localStorage.statsToday = JSON.stringify(ee), n("#NoKills", e => e.remove())
- }
- function u(e, t) {
- ce[e] ? setTimeout(t) : r("/" + q + "/economy/marketpicture/" + e, function(n) {
- ce[e] = n, t()
- })
- }
- function f(e) {
- return 1 == e ? "food" : 2 == e ? "weapons" : 3 == e ? "tickets" : 4 == e ? "houses" : 7 == e ? "frm" : 12 == e ? "wrm" : 17 == e ? "hrm" : 23 == e ? "aircraft" : "arm"
- }
- function g(t, n) {
- e.push(function(e, i) {
- i.includes(t) && setTimeout(n)
- })
- }
- function m(e) {
- return e in G ? G[e] : K[e]
- }
- function b(e) {
- document.body.insertAdjacentHTML("afterBegin", '<div style="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.6);z-index:9999" onclick="this.remove()"><div style="background:red;color:#fff;text-align:center;width:100%;font:bold 15px Arial;padding:5px">' + e + "<br><button>Close</button></div></div>"), setTimeout(() => location.reload(), 6e4)
- }
- function h(e, t, n, i) {
- var o = Date.now() + 1e3 * t;
- ! function t() {
- var a = (o - Date.now()) / 1e3;
- if (a < 1) n(e);
- else {
- var r = Math.floor(a / 3600),
- l = Math.floor(a % 3600 / 60),
- s = Math.floor(a % 60);
- e.textContent = (i ? (r > 9 ? r : "0" + r) + ":" : "-") + (i ? l > 9 ? l : "0" + l : l) + (i ? "" : "m") + ":" + (s > 9 ? s : "0" + s) + (i ? "" : "s"), setTimeout(t, 1e3)
- }
- }()
- }
- function v() {
- n("#xpleft span", function(e) {
- var t = 5e3 - z.currentExperiencePoints % 5e3;
- e.textContent = t, e.style.background = t > 500 ? "#6ebce5" : "#FB7E3D"
- })
- }
- function y(e, t, n, i, o) {
- var a = {
- _token: csrfToken,
- battleId: n || 0
- };
- e && (a.toCountryId = e), t && (a.inRegionId = t), i && (a.sideCountryId = i), l("/" + q + "/main/travel/", a, function() {
- o ? o() : location.reload()
- })
- }
- function x(e, t) {
- return e < 10 && !t ? "0" + e : e
- }
- function k(e, t) {
- var n = Math.max(360 * Math.ceil(((e ? Math.max(reset_health_to_recover - globalNS.userInfo.wellness, 0) : 0) + reset_health_to_recover - food_remaining) / globalNS.userInfo.energyPerInterval) - 360 + 60 * parseInt(se.textContent), 0);
- return x(parseInt(n / 3600), t) + (t ? "h " : ":") + x(parseInt(n % 3600 / 60), t) + (t ? "m" : "")
- }
- function _(e) {
- return "<span class='stuffTipsySpan'>" + e + "</span><br>"
- }
- function E() {
- return Math.min(reset_health_to_recover - globalNS.userInfo.wellness, food_remaining) >= smallestFood.use
- }
- function w(e) {
- var n = 0;
- return t(e.inventoryItems.finalProducts.items, (e, t) => n += 1 == t.industryId && t.quality < 8 ? t.amount * t.attributes.energyRestore.value : 0), n
- }
- function T() {
- n(".costperUse,#otherMarket,.travelToMarket", e => e.remove());
- var e = angular.element("#marketplace").scope(),
- t = [e.settings.isSharedOffer ? e.marketplace[0].country_id : e.settings.countryId, e.settings.industryId, e.settings.isSharedOffer ? e.marketplace[0].customization_level : e.settings.lastQuality],
- o = t[0] == z.country ? z.countryLocationId : z.country,
- a = document.getElementById("erepDE"),
- r = document.querySelector("#marketplace h1");
- a ? a.href = "//erepublik.tools/en/marketplace/items/0/" + t[1] + "/" + t[2] + "/offers" : (i("#otherMarket,#otherMarket span{padding:0 4px;border-radius:2px;float:right}#otherMarket{background:#83b70b;color:#fff;cursor:pointer;text-shadow:0 0 2px #000}#otherMarket:hover{background:#fb7e3d}#otherMarket span{background:#fb7e3d;margin:0 -4px 0 4px}#erepDE{color:#83b70b;float:right;margin:0 70px 0 10px}#erepDE:hover{color:#fb7e3d}#erepDE span{color:#42a5f5}.costperUse{font-size:11px}.travelToMarket{position:absolute;top:1px;right:10px}"), r && r.insertAdjacentHTML("beforeEnd", '<a id="erepDE" href="//erepublik.tools/en/marketplace/items/0/' + t[1] + "/" + t[2] + '/offers">eRepublik<span>.tools</span></a>')), e.settings.isSharedOffer ? n(".list_products", e => e.insertAdjacentHTML("afterEnd", '<a href="/' + q + "/economy/marketplace#" + t[0] + "/" + t[1] + "/" + t[2] + '" class="std_global_btn smallSize blueColor" style="top:15px;left:420px">Show all offers</a>')) : z.countryLocationId == z.country && t[0] == z.country || u(o, function() {
- var e = (((ce[o][f(t[1])] || {})["q" + t[2]] || [])[0] || {}).gross;
- r && r.insertAdjacentHTML("beforeEnd", '<a id="otherMarket">' + j.info.countries[o].name + "<span>" + (e ? e.toFixed(2) + z.currency : "No offers") + "</span></a>"), document.getElementById("otherMarket").addEventListener("click", () => n("#countryId", function(e) {
- e.value = o, e.dispatchEvent(new Event("change"))
- }))
- }), e.settings.can_buy || e.settings.my_offer || A("#filters_expanded", t[0]), t[1] < 2 && n("#marketplace .price_sorted tr", function(e) {
- var n = e.getElementsByClassName("m_price")[0];
- n.insertAdjacentHTML("beforeEnd", '<span class="stprice costperUse"><br>' + (parseFloat(n.textContent) / industryJSON[t[1]].attributes[t[2]].effect).toFixed(4) + " cc/hp</span>")
- }), n(".last", function(t) {
- t.title = "Page " + e.settings.totalPages, s(t)
- })
- }
- function A(e, i) {
- n(e, e => e.insertAdjacentHTML("beforeEnd", '<a class="std_global_btn smallSize blueColor travelToMarket">Travel to market</a>')), n(".travelToMarket", e => e.addEventListener("click", () => l("/" + q + "/main/travelData", {
- check: "getCountryRegions",
- countryId: i,
- _token: csrfToken
- }, function(e) {
- var n = [0, 999];
- t(e.regions, function(e, t) {
- t.canMove && t.countryId == i && t.cost < n[1] && (n = [e, t.cost])
- }), n[0] ? y(i, n[0]) : humanMsg.displayMsg("Wiped country - no possible regions to travel to")
- })))
- }
- function S(e, t) {
- i("#erepDE{color:#83b70b;float:right;margin:0 20px}#erepDE:hover{color:#fb7e3d}#erepDE span{color:#42a5f5}"), n(e + " h1", e => e.insertAdjacentHTML("beforeEnd", '<a id="erepDE" href="//erepublik.tools/en/marketplace/' + t + '">eRepublik<span>.tools</span></a>'))
- }
- function I() {
- var e = [7, 12, 17, 24].includes(+angular.element("#marketplace").scope().settings.industryId);
- n(".buyField", function(t) {
- t.value = Math.min(t.nextElementSibling.nextElementSibling.getAttribute("maximum"), Math.max(Math.floor((window.freeSpace || 99999999) / (e ? 100 : 1)) - (e ? 1 : 0), 0)), t.dispatchEvent(new Event("input"))
- })
- }
- function M() {
- var e = G["battleType" [4]],
- t = e[V];
- return Object.keys(e).length > 5 && t && t >= re ? t - re : 0
- }
- function C() {
- var e = M(),
- t = e ? e + "d left" : "Expired";
- n(".stuffBtn+.stuffBtn span,#AF_l", (e, n) => e.textContent = n ? "License: " + t : t.split(" ")[0])
- }
- function L() {
- G.version && G.version != GM_info.script.version && n(".stuffBtn,#stuffOptions>:nth-child(1) a:nth-child(3)", function(e, t) {
- e.style.background = "#F95555", t || (e.childNodes[0].nodeValue = "CLICK TO UPDATE")
- })
- }
- function R(e, t, n, i) {
- var o = {
- _token: csrfToken,
- battleId: e,
- battleZoneId: t
- };
- n && (o.sideCountryId = n), l("/" + q + "/main/battlefieldTravel", o, () => i ? 0 : location.href = "/" + q + "/military/battlefield/" + e)
- }
- function B(e, t) {
- l("/" + q + "/military/battle-console", {
- action: "battleStatistics",
- battleZoneId: e,
- type: "damage",
- leftPage: 1,
- rightPage: 1,
- _token: csrfToken
- }, t)
- }
- function D(e) {
- var t = e.data,
- n = t ? +t.damage.replace(/,/g, "") : e.bomb ? e.bomb.damage : e.oldEnemy.isNatural ? Math.floor(1.1 * e.user.givenDamage) : e.user.givenDamage,
- i = t ? +t.rewards.prestigePoints.replace(/,/g, "") : e.hits || 1,
- a = t ? +t.kills.replace(/,/g, "") : 1;
- ee[0] += a, ee[1] += i, ee[SERVER_DATA.onAirforceBattlefield ? 3 : 2] += n, localStorage.statsToday = JSON.stringify(ee), personal_stats.forEach(function(e, t) {
- savedStats[t] = +savedStats[t] + (t ? t < 2 ? i : n : a), e.textContent = o(savedStats[t])
- }), document.cookie = SERVER_DATA.battleZoneId + "-" + SERVER_DATA.leftBattleId + "=" + savedStats.join("|") + ";max-age=7200", v(), window.mercenaryEl && (mercenaryEl.textContent = Math.min(+mercenaryEl.textContent + a, 25)), window.freedomFighterEl && (freedomFighterEl.textContent = Math.min(+freedomFighterEl.textContent + a, 75))
- }
- function F() {
- r("/" + q + "/main/citizen-profile-json/" + V, function(e) {
- i("#mercFFTPcontainer{position:absolute;top:1px;z-index:5;text-align:center;text-shadow:0 0 2px #000}#mercFFTPcontainer div{color:#fff;padding:3px;font:700 11px Arial;width:40px;display:inline-block}#mercenary{background:#fb7e3d}#freedom_fighter{background:#83b70b}#mercFFdiv{position:absolute;bottom:44px;right:5px}#mercFFdiv span{cursor:default;border-radius:1px;padding:3px;color:#4c4c4c;font:700 11px arial;margin:3px}.countyTime>div{text-align:center;position:absolute;width:90px;right:0;top:17px}.countyTime div div{display:inline;padding:1px 3px 0;margin:0 2px;background:rgba(255,255,255,.5)}");
- var o = e.freedomFighter,
- a = o.milestone.kills,
- r = e.achievements[11].mercenaryProgress;
- if (oe) {
- var l = 0,
- c = document.getElementById("region_name_link").textContent.split(" [")[0];
- t(o.progress.wars.inprogress, function(e, t) {
- t.region == c && (l = Math.min(t.kills, 75))
- });
- var d = SERVER_DATA.isResistance && (SERVER_DATA.leftBattleId == SERVER_DATA.realInvaderId || SERVER_DATA.spectatorOnly);
- n("#pvp", e => e.insertAdjacentHTML("beforeEnd", '<div id="mercFFTPcontainer"><div id="mercenary" title="Mercenary kills"><q>' + r.details[SERVER_DATA.leftBattleId].enemies_killed + "</q> - " + r.details[SERVER_DATA.rightBattleId].enemies_killed + "</div>" + (d ? '<div id="freedom_fighter" title="Freedom Fighter kills"><q>' + l + "</q> / <q>" + a + "</q></div>" : "") + "</div>")), d && n("#kills", e => e.value = a - l > 0 ? a - l : 25), mercenaryEl = document.querySelector("#mercenary q"), freedomFighterEl = document.querySelector("#freedom_fighter q:first-child")
- } else n(".battlesList li", function(e, n) {
- var i = angular.element(e).scope().campaign,
- l = r.details[i.inv.id].enemies_killed,
- s = r.details[i.def.id].enemies_killed,
- c = 0;
- if (t(o.progress.wars.inprogress, function(e, t) {
- t.war_id == i.war_id && (c = Math.min(t.kills, 75))
- }), i.is_dict || i.is_lib || e.querySelectorAll(".countyTime").forEach(function(e) {
- e.insertAdjacentHTML("beforeEnd", "<div>" + (c ? '<div title="Freedom Fighter kills"><span' + (c < a ? ' style="color:#FF6600"' : "") + ">" + c + "</span> / " + a + "</div>" : "") + '<div title="Mercenary kills"><span style="color:#' + (l ? l < 25 ? "FF6600" : "" : "DD0000") + '">' + l + '</span> - <span style="color:#' + (s ? s < 25 ? "FF6600" : "" : "DD0000") + '">' + s + "</span></div></div>"), e.querySelector("div").style.backgroundColor = getComputedStyle(e).getPropertyValue("background-color")
- }), G.battleFilter || i.is_dict || i.is_lib || "25 - 25" == e.querySelector(".countyTime div div:last-child").textContent || battlesByType.merc.push(i.id), !n) {
- var d = [o.progress.regions, o.milestone.regions];
- e.insertAdjacentHTML("beforeEnd", '<div id="mercFFdiv"><span title="' + (d[1] - d[0]) * a + ' kills needed">Freedom Fighter ' + d[0] + "/" + d[1] + " (x" + a + ')</span><span title="' + 25 * (50 - r.progress.current) + ' kills needed">Mercenary ' + r.progress.current + "/50</span></div>")
- }
- }), G.battleFilter || n("#battleFilters a", function(e) {
- var t = e.getAttribute("value");
- "merc" == t && (e.querySelector("span").textContent = battlesByType.merc.length), t == G.battleFilter_lastView && e.click()
- });
- n("#mercFFdiv span,#mercenary,#freedom_fighter,.countyTime div div", e => s(e))
- })
- }
- function P() {
- function e(t) {
- r("/" + q + "/main/citizen-friends/" + V + "/" + t + "/list", function(n) {
- (new DOMParser).parseFromString(n.content, "text/html").querySelectorAll(".dead").forEach(function(e) {
- var t = e.id.split("_")[1];
- a.includes(t) || a.push(t)
- }), d[0].textContent = "Scanning... " + (t / c * 100).toFixed(1) + "%", t < c ? e(t + 1) : function e() {
- a.length ? (d[0].textContent = "Removing... " + a.length + " left", l("/" + q + "/main/citizen-friends/" + a.pop() + "/1/remove?_token=" + csrfToken, {}, function() {
- s.textContent = s.textContent.replace(/\d+/, +s.textContent.match(/\d+/)[0] - 1), e()
- })) : (d[0].textContent = "Done!", d[0].style.background = "#83B70B")
- }()
- })
- }
- i("#achievment>li{margin:3px 5px}#contributor,#removeDead{background:#83b70b;font:700 11px Arial;text-align:center;border-radius:1px;text-shadow:0 0 2px #000}#contributor{position:absolute;width:152px;padding:3px;color:#fff;cursor:default;z-index:999}#removeDead{width:100%;display:inline-block;cursor:pointer;color:#fff;padding:3px 0}#removeDead:hover{background:#fb7e3d}#erepboxStats{float:right;margin:-4px 10px;width:24px}#erepboxStats:hover{transform:scale(1.2,1.2)}#erepDE{font:800 12px Arial;color:#83b70b;position:absolute;right:50px}#erepDE:hover{color:#fb7e3d}#erepDE span{color:#42a5f5}"), n(".citizen_avatar", e => e.outerHTML = '<a href="//erpk-static-avatars.s3.amazonaws.com/' + e.getAttribute("style").split("smart/")[1].split(")")[0] + '">' + e.outerHTML + "</a>");
- var t = +location.href.split("/")[6],
- o = 0;
- if (n(".counter", e => o += +e.textContent), n("#career_tab_content", e => e.previousElementSibling.insertAdjacentHTML("beforeEnd", " (" + o + ')<a href="//erepbox.russianwill.ru/content/profile/profile.php?id=' + t + '"><img id="erepboxStats" src="//erepbox.russianwill.ru/images/logo.png" title="Click for more stats"></a><a id="erepDE" href="//erepublik.tools/en/society/citizen/' + t + '" title="Click for more stats">eRepublik<span>.tools</span></a>')), G.contributors && G.contributors.includes(t) && n(".citizen_sidebar", e => e.insertAdjacentHTML("afterBegin", '<div id="contributor">Stuff++ Contributor<div>')), location.href.includes("/citizen/profile/" + V)) {
- n(".citizen_activity", function(e) {
- e.style.padding = 0, e.insertAdjacentHTML("beforeEnd", '<div id="removeDead">Remove dead friends</div>')
- });
- var a = [],
- s = document.querySelector(".friends_title a"),
- c = Math.ceil(s.textContent.match(/\d+/)[0] / 20);
- n(".view_friends", e => e.remove());
- var d = n("#removeDead", t => t.addEventListener("click", function() {
- a = [], e(1), t.style.background = "#FB7E3D"
- }))
- } else n("#donate_to_friend div", e => e.remove())
- }
- function O() {
- function e(e) {
- t(battleListingScope.campaigns.initialList, function(t, i) {
- var o = N(i);
- if (o[0] == e) return n = !0, document.getElementById("menu3").insertAdjacentHTML("beforeEnd", '<a id="epicLink" division="' + o[1] + '" href="/' + q + "/military/battlefield/" + t + '" style="position:absolute;top:8px;left:225px;width:30px;background:none"><img src="/images/modules/misc/' + (e > 1 ? "epic_battles_icon" : "full_scale_battle") + '.png" style="width:30px"></a>'), document.getElementById("epicLink").addEventListener("click", function() {
- event.preventDefault(), R(this.href.split("battlefield/")[1], this.getAttribute("division"))
- }), document.title = (e > 1 ? "EPIC BATTLE" : "FULL SCALE") + " DETECTED", !1
- })
- }
- var n = !1;
- e(2), n || e(1)
- }
- function N(e) {
- var n = [],
- i = 0;
- return (!e.is_dict && !e.is_lib || G.ignoreDictatorship) && t(e.div, function(e, t) {
- var o = t.epic;
- (ae || t.div == z.division) && o && t.dom_pts.def < 1800 && t.dom_pts.inv < 1800 && o >= i && (i = o, n = [o, e])
- }), n
- }
- function H() {
- r("/" + q + "/main/sessionUnlockPopup", function() {
- var e = SERVER_DATA.sessionValidation.captchaId;
- $j.post("/" + q + "/main/sessionGetChallenge", {
- _token: csrfToken,
- captchaId: e,
- env: sessionCaptcha.getEnv()
- }, function(t) {
- var n = t.sliderX || 30 + Math.round(200 * Math.random()),
- i = [0],
- o = [0];
- for (let e = 1; e <= 999 && (i.push(Math.max(i[e - 1] + Math.round(6 * Math.random() - 2), i[e - 1] + 1)), o.push(o[e - 1] + Math.round(2 * Math.random() - 1)), i[e] != n); e++)
- if (i[e] > n) {
- i.push(n), o.push(o[e] + Math.round(2 * Math.random() - 1));
- break
- } setTimeout(() => $j.post("/" + q + "/main/sessionUnlock", {
- _token: csrfToken,
- captchaId: e,
- src: t.src,
- imageId: t.imageId,
- challengeId: t.challengeId,
- sliderResult: JSON.stringify({
- x: i,
- y: o
- }),
- env: sessionCaptcha.getEnv()
- }, function(e) {
- e.verified ? location.reload() : setTimeout(H, 1e3)
- }), 5e3 * Math.random() + 5e3)
- })
- })
- }
- setTimeout(function() {
- (localStorage.scriptData || window.___RUNTIME || localStorage.ChoosenInfo) && localStorage.clear()
- }, 5e3);
- var j = window.erepublik || {},
- z = j.citizen || {},
- q = (j.settings || {}).culture || "en",
- W = z.residence,
- V = z.citizenId || 0,
- U = V % 397854 == 0,
- K = {
- work: !0,
- train: !0,
- workOvertime: !0,
- collectWcRewards: !0,
- returnToResidence: !0,
- energyRatio: 1.75,
- maxKills: 25,
- epicAllIn: !0,
- prefWeapGround: 7,
- prefWeapAir: -1,
- battlePrios: ["epic", "TP", "DO", "RW", "anyNoTravel"],
- allowTravel: !0,
- battleType: U || z.division < 4 ? "ground" : "both",
- preferCountries: "",
- avoidCountries: "",
- l: {},
- b: []
- },
- G = JSON.parse(localStorage.stuff || 0) || K,
- Q = m("prefWeapGround"),
- J = m("prefWeapAir"),
- Z = m("battlePrios"),
- Y = m("battleType"),
- X = m("allowTravel"),
- $ = m("epicAllIn"),
- ee = JSON.parse(localStorage.statsToday || "[0, 0, 0, 0]"),
- te = Environment.isOnHomepage,
- ne = top == self,
- ie = location.href.includes("military/campaigns"),
- oe = SERVER_DATA.battleId,
- ae = "true" == localStorage.hasMaverick;
- (!G.autoRefresh && te || !window.$j && !top.location.href.includes("A/u/t/o/F/i/g/h/t/e/r")) && setTimeout(() => location.href = "/", 6e5);
- var re = j.settings.eDay || G.update || 0,
- le = document.getElementsByClassName("lvl")[0],
- se = document.getElementById("foodResetHours"),
- ce = {};
- if (re && G.update != re && c(1), !G.b.includes(V))
- if (SERVER_DATA.sessionValidation) !M() || !U && ne || setTimeout(H, 5e3);
- else {
- document.body.insertAdjacentHTML("beforeEnd", '<div id="stuffTipsy"></div>');
- var de = document.getElementById("stuffTipsy");
- if (i("#large_sidebar{left:auto!important}#stuffTipsy{visibility:hidden;background:#fff;text-shadow:0 1px 0 rgba(255,255,255,.3);font:200 10px Arial;color:#5a5a5a;text-align:center;padding:5px;border-radius:2px;position:fixed;z-index:999999;box-shadow:0 0 5px gray;pointer-events:none}.stuffTipsySpan{padding:1px 3px;margin:1px 0;color:#fff;background:#83b70b;font:700 11px Arial;text-shadow:0 0 2px #000;border-radius:5px;display:inline-block}"), document.getElementById("login_form") && !G.autoLogin && (n("#remember", e => e.checked = !0), n("#login_form button", function(e) {
- var t = n("#login_form input[id^=citizen_]");
- t[0] && t[0].value.length > 2 && t[1] && t[1].value.length > 2 && e.click()
- })), le ? le.style.left = 0 : W.hasResidence && z.regionLocationId != W.regionId && (n(".user_location", e => e.insertAdjacentHTML("beforeEnd", '<a class="std_global_btn smallSize blueColor" id="travelBackHome" style="left:-5px"><span>Travel back home</span></a>')), n("#travelBackHome", e => e.addEventListener("click", () => y(W.countryId, W.regionId)))), !ne || ! function() {
- if (i("#stuffBlock,#stuffOptions>*{display:none;position:fixed}#stuffOptions a,.stuffBtn{cursor:pointer;background:#83b70b;border-radius:1px}#stuffOptions a:hover,#stuffOptions span,.stuffBtn span,.stuffBtn:hover,#AFlaunch:hover{background:#fb7e3d}#stuffOptions span,.stuffBtn{color:#fff;display:inline-block;text-align:center}.stuffBtn{" + (le ? "margin:6px 2px;font:700 11px/13px Arial;padding:2px 0 2px 3px;float:left;border-radius:9px" : "margin:5px 0 -5px;width:100%;font:700 11px/14px Arial;padding:3px 0") + ";text-shadow:0 0 2px #000}.stuffBtn span{float:right;" + (le ? "margin:-2px 0 -2px 2px;padding:2px 3px" : "margin:-3px 0;padding:3px 7px") + "}#AFlaunch{position:fixed;bottom:80px;left:5px;width:100px;height:100px;background:#83b70b;cursor:pointer;border-radius:50px;box-shadow:2px 2px 5px gray;z-index:9}#AFlaunch div{margin:25px 30px;border-style:solid;border-width:25px 0 25px 50px;border-color:transparent transparent transparent #fff}"), re / 100 > 45) return 1;
- var e;
- n(le ? ".misc" : ".user_finances", e => e.insertAdjacentHTML(le ? "afterBegin" : "afterEnd", '<div class="stuffBtn">' + (le ? "Stuff++" : "eRepublik Stuff++") + "<span>" + GM_info.script.version + "</span></div>" + (G.autoFighter ? "" : '<div class="stuffBtn">' + (le ? "AF" : "AutoFighter") + "<span>" + GM_info.script.version + "</span></div>"))), n(".stuffBtn", (t, o) => t.addEventListener("click", function() {
- if (!e) {
- e = 1, i("#stuffOptions>*{background:#000;box-shadow:0 1px 4px;cursor:default;top:50%;left:50%;transform:translate(-50%,-50%);z-index:9999;border-radius:5px;text-shadow:0 0 2px #000}#stuffOptions>*>:first-child{position:absolute;top:-20px;width:100%;text-align:center}#stuffOptions>:first-child>:not(:first-child){width:48%;margin:1%;float:left;background:#242b27}#stuffOptions a{color:#fff;font-weight:700;padding:5px;margin:20px}#stuffBlock{z-index:9999;top:0;width:100%;height:100%;background:rgba(0,0,0,.6)}#stuffOptions label{color:#fff;padding:2px 5px;display:inline-block}#stuffOptions>:first-child label{width:96.7%;font-size:13px}#stuffOptions label:hover{background:#5f5757}#stuffOptions span{padding:2px 0;font-weight:700;width:100%}#stuffOptions input,#stuffOptions select{float:right;margin:2px 0}#stuffOptions>:nth-child(2) input[type=checkbox]{position:relative;top:2px}#stuffOptions input[type=text]{width:280px;text-align:center}#stuffOptions>:nth-child(2) label{width:97.8%;font:13px/22px Arial}#stuffOptions>div>:nth-child(2) a{margin:0px;background:none;color:#83b70b}#stuffOptions>div>:nth-child(2) a:hover{color:#fb7e3d}");
- var t = '<select class="battlePrio"><option value="epic">Epic battles</option><option value="DO">Daily order</option><option value="TP">TP battles - any</option><option value="TPrw">TP - resistance wars</option><option value="TPdirect">TP - direct battles</option><option value="RW">Resistance wars</option><option value="anyNoTravel">Any no-travel battle</option><option value="anyNoTravelAir">Any no-travel air battle</option><option value="anyNoTravelGround">Any no-travel ground battle</option><option value="anyAir">Any air battle</option><option value="anyGround">Any ground battle</option><option value="any">Any battle</option><option value="none">None</option></select>';
- document.body.insertAdjacentHTML("beforeEnd", '<div id="stuffBlock"></div><div id="stuffOptions"><div style="width:602px"><div><a href="//docs.google.com/spreadsheets/d/1nal62cgC7lUmrur6NRzlPVU3uxtE59WGV9-bZcPoIw8">Stuff++ Website</a><a class="eRSreset">RESET</a><a href="//dl.dropboxusercontent.com/s/p0ylkka916ovsl7/eRepublik_Stuff++.user.js">UPDATE</a><a href="/' + q + '/citizen/profile/6365664">Contact / Donate</a><a>Close</a></div><div><span>Battlefield</span><label>Improved battlefield<input id="battlefield" type="checkbox"></label><label>AutoBot<input id="autoBot" type="checkbox"></label><span>Companies</span><label>Company manager<input id="companyManager" type="checkbox"></label><label>Show the best local job offer<input id="showBestJobOffer" type="checkbox"></label><span>Energy</span><label>Automatic energy recovery<input id="energyRecovery" type="checkbox"></label><label>Show remaining time to full health reserve<input id="fullEnergy" type="checkbox"></label><label>Show recoverable energy<input id="maxEnergy" type="checkbox"></label><span>Main page</span><label>Hide medal posts<input id="hideMedals" type="checkbox"></label><label>Improved feeds<input id="improveFeeds" type="checkbox"></label><label>Autorefresh main page every 10 minutes<input id="autoRefresh" type="checkbox"></label><span>Marketplace</span><label>Improved marketplace<input id="improveMarketplace" type="checkbox"></label><label>Autofill maximum item amount<input id="autofillMarket" type="checkbox"></label><label>Direct market links in main menu<input id="marketLinks" type="checkbox"></label><span>Monetary market</span><label>Autofill maximum gold amount<input id="autofillGold" type="checkbox"></label><span>Profile</span><label>Improved profile page<input id="improveProfile" type="checkbox"></label><label>Influence calculator<input id="influenceCalculator" type="checkbox"></label></div><div><span>Storage</span><label>Improved inventory<input id="improveInventory" type="checkbox"></label><label>Display sidebar storage<input id="displayStorage" type="checkbox"></label><span>Wars page</span><label>Battle stats tooltips<input id="getPoints" type="checkbox"></label><label>Direct links for each side in RWs<input id="directRWLinks" type="checkbox"></label><label>Single row layout<input id="singleRowWars" type="checkbox"></label><label>Display deployed allies in MPP battles<input id="showMPPs" type="checkbox"></label><label>Battle filter<input id="battleFilter" type="checkbox"></label><label>Replace "waiting" with countdown timers<input id="replaceWaitingwithCountdown" type="checkbox"></label><span>Other</span><label>AutoFighter<input id="autoFighter" type="checkbox"></label><label>Display XP needed to level-up<input id="xpLeft" type="checkbox"></label><label>Kills, PP, and damage on sidebar<input id="showStats" type="checkbox"></label><label>Epic battle sensor<input id="epicSensor" type="checkbox"></label><label>Ignore epic dictatorship battles<input id="ignoreDictatorship" type="checkbox"></label><label>Show active damage boosters everywhere<input id="damageBoosterTimer" type="checkbox"></label><label>Mercenary and Freedom Fighter progress<input id="mercFF" type="checkbox"></label><label>Remove external link warning<input id="externalLinks" type="checkbox"></label><label>Improved player hovercards<input id="playerTooltip" type="checkbox"></label><label>Automatic login<input id="autoLogin" type="checkbox"></label><label>Block pack/promo popups<input id="popupBlocker" type="checkbox"></label></div></div><div style="width:452px"><div><a href="//docs.google.com/spreadsheets/d/1APUYLfQfiNW1MbZmE1nMA8mFrcWbkFVvD9AK9JmVj08">AutoFighter Website</a><a class="eRSreset">RESET</a><a href="/' + q + '/citizen/profile/6365664">Contact</a><a>Close</a></div><div style="width:98%;margin:1%;float:left;background:#242B27"><span>Settings<div id="AF_l" style="position:absolute;top:6px;right:10px;color:yellow"></div></span><label>Train<input id="train" type="checkbox"></label><label>Work (for employer)<input id="work" type="checkbox"></label><label>Work overtime<input id="workOvertime" type="checkbox"></label><label>Collect Weekly Challenge rewards<input id="collectWcRewards" type="checkbox"></label><label>Return to residence<input id="returnToResidence" type="checkbox"></label><label>Don\'t fight until you have<input id="energyRatio" type="range" min="0" max="2.00" step="0.05"><b style="float:right;margin:0 5px"></b></label><label>Maximum kills to do in one go<input id="maxKills" type="number" min="1" style="width:70px;text-align:right"></label><label>Go all-in in epic battles (without EBs)<input id="epicAllIn" type="checkbox"></label><label>Preferred ground weapon<select id="prefWeapGround"><option value="0">No preference</option><option value="-1">Q0</option><option value="1">Q1</option><option value="2">Q2</option><option value="3">Q3</option><option value="4">Q4</option><option value="5">Q5</option><option value="6">Q6</option><option value="7">Q7</option><option value="10">Bazooka</option></select></label><label>Preferred air weapon<select id="prefWeapAir"><option value="0">No preference</option><option value="-1">Q0</option><option value="1">Q1</option></select></label><label>Battle priority #1' + t + "</label><label>Battle priority #2" + t + "</label><label>Battle priority #3" + t + "</label><label>Battle priority #4" + t + "</label><label>Battle priority #5" + t + '</label><label>Allow travel if needed<input id="allowTravel" type="checkbox"></label><label>Battle type preference<select id="battleType"><option value="both">No preference</option><option value="ground">Ground ONLY</option><option value="air">Air ONLY</option></select></label><label>Preferred countries<input id="preferCountries" type="text" placeholder="comma-separated country IDs, e.g. 67,68,69"></label><label>Avoided countries<input id="avoidCountries" type="text" placeholder="comma-separated country IDs, e.g. 67,68,69"></label><a href="http://wcsimulator.droppages.com/countryids.html" id="countryIDs">Country IDs</a></div></div></div>'), L(), n("#stuffOptions a:last-child,#stuffBlock", e => e.addEventListener("click", () => n("#stuffOptions>*,#stuffBlock", e => e.style.display = "none"))), n(".eRSreset", e => e.addEventListener("click", function() {
- localStorage.clear(), location.href = "/"
- })), n("#stuffOptions>*", (e, t) => e.querySelectorAll("input").forEach(function(e) {
- var n = "checkbox" == e.type ? "checked" : "value";
- t ? e[n] = m(e.id) : e.checked = !G[e.id], e.addEventListener("change", function() {
- G[e.id] = t ? "text" == e.type ? e.value.replace(/[^0-9,]/g, "") : e[n] : !e.checked, d()
- })
- })), n("#energyRatio", function(e) {
- var t = e.nextSibling;
- e.addEventListener("input", function() {
- var n = (e.value * reset_health_to_recover).toFixed(0);
- t.textContent = n > reset_health_to_recover ? reset_health_to_recover + "hp+" + (n - reset_health_to_recover) + "hp" : n + "hp", t.style.color = e.value < 1.8 && e.value > .5 ? "#83B70B" : "red"
- }), e.dispatchEvent(new Event("input"))
- }), n("#prefWeapGround,#prefWeapAir,#battleType", function(e, t) {
- e.value = 2 == t ? Y : t ? J : Q, e.addEventListener("change", function() {
- G[2 == t ? "battleType" : t ? "prefWeapAir" : "prefWeapGround"] = e.value, d()
- })
- }), n(".battlePrio", function(e, t) {
- e.value = Z[t], e.addEventListener("change", function() {
- G.battlePrios[t] = e.value, d()
- })
- })
- }
- c(), n("#stuffOptions>:nth-child(" + (o + 1) + "),#stuffBlock", e => e.style.display = "block")
- })), L(), G.autoFighter || document.body.insertAdjacentHTML("beforeEnd", '<div id="AFlaunch" title="Click to launch AutoFighter"><div></div></div>'), n("#AFlaunch", function(e) {
- s(e, "e"), e.addEventListener("click", function() {
- M() ? location.href = "/A/u/t/o/F/i/g/h/t/e/r" : b("Could not find a valid license or your license has expired. If you think this is incorrect, open the settings and click RESET.")
- })
- }), C()
- }()) {
- if (z.currentExperiencePoints && window.reset_health_to_recover && (G.energyRecovery || function() {
- function e() {
- var e = document.querySelector("#AutoBotSwitch");
- e && "AUTOBOT ON" == e.textContent || globalNS.userInfo.wellness >= reset_health_to_recover || !E() || !smallestFood.use || SERVER_DATA.deployment || t()
- }
- function t() {
- r("/" + q + "/main/eat?format=json&_token=" + csrfToken + "&buttonColor=blue", e => energy.processResponse(e))
- }
- function o() {
- return "Total hits: " + _(parseInt((globalNS.userInfo.wellness + food_remaining) / 10) + " / " + 2 * reset_health_to_recover / 10) + "Full hits in: " + _(k(!0, !0)) + "Full reserve in: " + _(k(!1, !0)) + "Click the health bar to force eat food"
- }
- i(".col{line-height:19px}"), e();
- var a = setInterval(e, 3e3);
- le ? n(".energyBg", function(e) {
- e.addEventListener("mouseenter", () => n("#wellnessTooltipNbp", function(e) {
- e.querySelectorAll(".bullets").forEach(e => e.remove()), e.insertAdjacentHTML("beforeEnd", '<span class="bullets">' + o() + "<div>")
- })), e.addEventListener("click", t)
- }) : (n(".health_bg", function(e) {
- s(e, "w", o), e.addEventListener("click", t)
- }), n("#DailyConsumtionTrigger", e => e.style.display = "none")), n("#fight_btn", t => t.addEventListener("click", function() {
- clearInterval(a), a = setInterval(e, 3e3)
- }))
- }(), G.xpLeft || (i("#xpleft{font-size:10px;top:" + (le ? "32px;right:769px;position:absolute" : "14px;color:#777;float:right;position:relative") + "}#xpleft span{padding:1px;color:#fff;border-radius:2px}"), n(le ? ".profileDetails" : ".user_level", e => e.insertAdjacentHTML("beforeEnd", '<div id="xpleft">XP left: <span></span></div>')), le && (n("#DailyConsumtionTrigger", e => e.style.visibility = "hidden"), n(".energyTooltip", e => e.style.top = "42px"), le.style.top = "30px"), v()), G.maxEnergy || function() {
- i(".health_bar strong#maxRecover{line-height:14px;text-align:right;background:none;float:right;right:2px;" + (le ? "position:absolute;z-index:4;font-size:9px;text-shadow:0 0 5px rgba(0,0,0,.85);font-weight:unset" : "") + "}"), n("#current_health", e => e.insertAdjacentHTML("afterEnd", '<strong id="maxRecover"></strong>'));
- var e = document.getElementById("maxRecover");
- setInterval(() => e.textContent = food_remaining, 200)
- }(), G.fullEnergy || setTimeout(function() {
- i(".health_bar strong#full_energy{line-height:14px;text-align:left;left:" + (le ? "10px;position:absolute;z-index:4;font-size:9px;text-shadow:0 0 5px rgba(0,0,0,.85);font-weight:unset" : "15px") + ";background:none;float:left}"), n("#current_health", e => e.insertAdjacentHTML("beforeBegin", '<strong id="full_energy"></strong>'));
- var e = document.getElementById("full_energy");
- setInterval(() => e.textContent = k(), 200)
- })), ne && (G.externalLinks || function() {
- function t() {
- n('a[href*="/main/warn/"]', e => e.href = atob(e.href.split("/main/warn/")[1]))
- }
- e.push(function(e, n) {
- /\/eat|\/inventory|\/campaigns/.test(n) || t(), n.includes("main/messages") && setTimeout(t, 300)
- }), t()
- }(), G.marketLinks || function() {
- function e(e, t, n) {
- return (n ? '<a href="/' + q + "/economy/marketplace#" + z.country + "/" + e + "/" + t + '">' : "<div>") + '<img src="//www.erepublik.net/images/icons/industry/' + e + "/q" + t + '.png">' + (n ? "</a>" : "</div>")
- }
- function t(t) {
- if (!t.target.querySelectorAll("a").length) {
- for (var n = t.target.getElementsByTagName("img")[0].src.split("industry/")[1].split("/")[0], i = "", o = 1; o < (n < 3 ? 8 : n < 5 ? 6 : 2); o++) i += e(n, o, 1);
- t.target.insertAdjacentHTML("beforeEnd", 3 == n ? i : i + e(1 == n ? 7 : 2 == n ? 12 : 4 == n ? 17 : 24, 1, 1)), location.href.includes("economy/marketplace") && t.target.querySelectorAll("a").forEach(e => e.addEventListener("click", () => setTimeout(() => location.reload(), 200)))
- }
- }
- i("#marketMenu div,#marketMenu div:hover a{display:inline-block}#marketMenu{position:absolute;top:30px;right:2px}#marketMenu *{width:27px;height:27px}#marketMenu div{line-height:0}#marketMenu a{display:none;float:left;clear:both;background:RGBA(131,183,11,.8);border-radius:5px}#marketMenu a:hover{background:#FB7E3D}#marketMenu img{margin-bottom:-5px}");
- for (var o = "", a = 1; a < 6; a++) o += e(1 == a ? 1 : 2 == a ? 2 : 3 == a ? 23 : 4 == a ? 3 : 4, 1 == a ? 1 : 2 == a ? 7 : 3 == a ? 1 : 4 == a ? 5 : 1);
- n("#newMenu", e => e.insertAdjacentHTML("beforeEnd", '<div id="marketMenu">' + o + "</div>")), n("#marketMenu", e => e.querySelectorAll("div").forEach(e => e.addEventListener("mouseenter", t)))
- }(), G.popupBlocker || function() {
- function e() {
- localStorage["promoPopupTimestamp_" + t.getFullYear() + "-" + t.getMonth() + "-" + t.getDate()] = 9999999999999
- }
- var t = new Date;
- e(), t.setDate(t.getDate() + 1), e()
- }()), G.showStats || le || (i("#NoKills{cursor:pointer;font:700 11px/14px arial;float:left;width:145px;margin:6px 3px 0}#NoKills strong{color:#666}#NoKills span{color:#3c8fa7;float:right}"), n(".user_finances", e => e.insertAdjacentHTML("afterEnd", '<div id="NoKills">' + (ee[0] || ee[1] ? "<strong>Kills | PP:</strong><span>" + o(ee[0]) + " | " + o(ee[1]) + "</span>" : "") + (ee[2] ? "<br><strong>Ground:</strong><span>" + o(ee[2]) + "</span>" : "") + (ee[3] ? "<br><strong>Air:</strong><span>" + o(ee[3]) + "</span>" : "") + "</div>")), n("#NoKills", e => e.addEventListener("click", p))), !ne || !te && !/military\/campaigns|\/citizen\/profile|\/economy\/marketplace|economy\/myCompanies/.test(location.href) || G.displayStorage && G.damageBoosterTimer || r("/" + q + "/economy/inventory-items/", function(e) {
- G.displayStorage || function(e) {
- function c(e, t) {
- return e.attributes[t] ? ("energyRestore" == t ? "Energy restore" : "firePower" == t ? "Firepower" : "energyPool" == t ? "Energy pool" : "") + ": " + _(o(e.attributes[t].value)) : ""
- }
- i("#sideInventory{opacity:0;transition:opacity 1s;position:absolute;line-height:0;max-height:80vh;column-width:39px;column-gap:1px;text-shadow:0 0 2px #000}#sideInventory img{height:39px;width:39px;background:linear-gradient(#eef1ec,#d5decf)}#sideInventory span{font:700 10px/13px arial;color:#fff;background:#83b70b;width:39px;text-align:center;cursor:default;display:block}#sideInventory div{box-shadow:1px 1px 5px gray;page-break-inside:avoid}.col{line-height:19px}#sideInventory q{background:red;display:block;width:100%}#overTime img{box-shadow:0 0 0 3px inset #fb7e3d}#overTime img:hover{filter:brightness(1.1)}" + (le ? "" : "#storageCapacity{float:left;color:#5a5a5a;text-shadow:0 1px 0 rgba(255,255,255,.9);font-size:11px;cursor:default}#storageCapacity img{float:left;margin:-1px 6px 0 2px;width:22px;height:16px}#storageCapacity strong{margin:0 1px}"));
- var d = w(e),
- p = 0,
- u = Object.assign(e.inventoryItems.finalProducts.items, e.inventoryItems.rawMaterials.items, (e.inventoryItems.activeEnhancements || {}).items || []),
- f = '<div id="sideInventory">';
- t(u, function(e, t) {
- if (t.icon && !t.isPartial) {
- var n = u[e + "_partial"],
- i = "4_100" == t.id && t.amount > 23 && z.dailyTasksDone && globalNS.userInfo.wellness > 9,
- r = t.isExpirable,
- l = r ? t.attributes.expirationInfo.value : 0;
- f += "<div " + (i ? 'id="overTime"' : "") + ' title="' + t.name + "<br>" + c(t, "energyRestore") + c(t, "firePower") + c(t, "energyPool") + (t.used ? "1 partially used " + _(t.used.durability.value + " " + t.used.durability.type + " left") : "") + (r ? l.join("<br>") : "") + (i ? _("Click to work overtime for 10hp") : "") + '"><img src="' + t.icon + '"><span>' + (t.active ? t.active.time_left > 864e3 ? Math.trunc(t.active.time_left / 86400) + "d" : t.active.time_left > 86400 ? Math.trunc(t.active.time_left / 86400) + "d" + Math.trunc(t.active.time_left % 86400 / 3600) + "h" : "<q>" + Math.trunc(t.active.time_left / 3600) + "h" + Math.trunc(t.active.time_left % 3600 / 60) + "m</q>" : t.isRaw ? Math.trunc(10 * (t.amount + (n ? n.amount.split("%")[0] / 100 : 0))) / 10 : r && /[0-9],[0-9]{3}/g.exec(l)[0].replace(",", "") - re < 8 || 1 == t.industryId && t.quality < 8 && d < 240 * globalNS.userInfo.energyPerInterval ? "<q>" + o(t.amount) + "</q>" : a(t.amount, 2)) + "</span></div>"
- }
- isNaN(t.amount) || (p += t.amount * ("1_10" == e ? 10 : "1_11" == e ? 20 : 0))
- }), document.body.insertAdjacentHTML("afterBegin", f + "</div>"), n("#sideInventory div", e => s(e, "e")), setTimeout(() => document.getElementById("sideInventory").style.opacity = 1), n("#overTime", e => e.addEventListener("click", () => r("/" + q + "/main/job-data", function(t) {
- var n = 1e3 * t.overTime.nextOverTime - Date.now();
- if (n < 0) l("/" + q + "/economy/workOvertime", {
- _token: csrfToken,
- action_type: "workOvertime"
- }, function(t) {
- var n = t.status && t.message;
- if (humanMsg.displayMsg(n ? "Success!" : "captcha" == t.message ? "Captcha - try to work on the companies page" : "Error: " + t.message), n) {
- var i = e.querySelector("span");
- i.textContent = +i.textContent - 24, +i.textContent < 1 ? e.remove() : e.removeAttribute("id"), globalNS.updateCurrency(z.currencyAmount + t.result.netSalary), energy.modifyHealth(globalNS.userInfo.wellness - 10), G.xpLeft || (z.currentExperiencePoints += 2, v())
- }
- });
- else {
- var i = parseInt(n / 6e4 + 1);
- humanMsg.displayMsg("You must wait " + i + " minute" + (i > 1 ? "s" : "") + " before working for 10hp again")
- }
- })));
- var g = o(e.inventoryStatus.usedStorage) + " / " + o(e.inventoryStatus.totalStorage);
- le ? (n(".currency", e => e.insertAdjacentHTML("afterEnd", '<article id="storageCapacity" class="currency"><span class="amount">' + g + '</span><img src="/images/modules/manager/tab_storage.png" class="icon" style="height:16px"></article>')), n("span.name", e => e.textContent = e.textContent.split(",")[0])) : n(".currency_amount", e => e.insertAdjacentHTML("afterEnd", '<div id="storageCapacity"><img src="/images/modules/manager/tab_storage.png"><strong></strong></div>')), freeSpace = e.inventoryStatus.totalStorage - e.inventoryStatus.usedStorage, s(document.getElementById("storageCapacity"), le ? "s" : "w", () => "Free space: " + _(o(freeSpace)) + "Total EB hits: " + _(o(p)) + "Total food HP: " + _(o(d))), n("#storageCapacity strong", function(e) {
- e.textContent = g, e.addEventListener("click", () => n("#InfCalc_hits", function(e) {
- e.value = p, e.dispatchEvent(new Event("keyup"))
- }))
- }), !G.autofillMarket && location.href.includes("economy/marketplace") && I()
- }(e), G.damageBoosterTimer || !te && !ie || function(e) {
- t((e.inventoryItems.activeEnhancements || {}).items || [], function(e, t) {
- "damageBoosters" == t.type && (i(".booster_timer{width:94px;height:36px;z-index:1;background-image:url(/images/modules/pvp/booster_time_small.png);" + (le ? "position:absolute;top:0;left:240px" : "margin:-10px 0 1px 40px") + "}#container .booster_timer strong{color:#FFF;top:11px;" + (le ? "left:40px;margin:0;position:absolute" : "left:19px;position:relative") + ";text-align:center;width:51px;font:700 13px ds-digitalbold_italic;float:none;text-shadow:none}"), n(le ? "#battle_listing" : ".sidebar_banners_area", e => e.insertAdjacentHTML("afterBegin", '<div class="booster_timer"><strong></strong></div>')), h(document.querySelector(".booster_timer strong"), t.active.time_left, e => e.parentNode.remove(), 1))
- })
- }(e)
- }), te) r("/" + q + "/military/campaignsJson/list", function(e) {
- battleListingScope = {
- campaigns: {
- initialList: e.battles
- }
- }, !G.epicSensor && ne && O()
- }), g("weekly-challenge-data", function() {
- i("#WCSimulator{position:absolute;right:10px;top:1px;font:700 11px/14px arial;text-shadow:0 0 2px #000;color:#fff;padding:0 3px;background:#83b70b;border-radius:1px}#WCSimulator:hover{background:#fb7e3d}"), n("#weeklyChallenge", e => e.insertAdjacentHTML("beforeEnd", '<a href="http://wcsimulator.droppages.com/" target="_blank" id="WCSimulator">WC calculator</a>')), n(".get_milestone_reward").length > 1 && n(".collectAll", function(e) {
- e.style.display = "block", e.addEventListener("click", () => e.style.display = "none")
- })
- }), G.improveFeeds || addEventListener("click", () => n(".commentsWrapper", e => e.parentElement.parentElement.querySelector(".postBtn").click())), G.hideMedals || (i("#citizenFeed .postsWrapper .postContainer.autoPost{display:none}"), g("wall-post/retrieve", function() {
- n(".postContainer:not(.autoPost)").length < 5 && n(".previousposts")[0].click()
- })),
- function() {
- if (ErpkShop.battlePromotions.length) {
- var e = "",
- t = ["battle_hero_promo", "sky_hero_promo", "campaign_hero_promo"];
- for (let n of ErpkShop.battlePromotions) t.includes(n.id) && (e += '<img src="//www.erepublik.net/images/achievements/icon_achievement_' + (n.id == t[0] ? "battlehero" : n.id == t[1] ? "skyhero" : "campaignhero") + '_on.gif" alt="battle hero">');
- e.length && (i("#eRSmedalpromo{text-align:center;clear:both;position:relative;top:-15px}#eRSmedalpromo:hover{border-bottom:solid 2px #83B70B}"), n("#large_sidebar", t => t.insertAdjacentHTML("beforeEnd", '<div id="eRSmedalpromo" title="More gold for medals. Click for details">' + e + "</div>")), n("#eRSmedalpromo", function(e) {
- e.addEventListener("click", () => angular.element("#ErpkPopupPromosControllerPopup").scope().showPopup()), s(e)
- }))
- }
- }();
- else if (ie) G.battleFilter || n("#campaignsSearchContainer", e => e.remove()), g("campaignsJson/citizen", function() {
- var e;
- battleListingScope = angular.element("#battle_listing").scope(), ne && (battleListingScope.showSection("allBattles") || n(".allbattles", e => e.click()), G.directRWLinks || (i(".RWQuickLink span:hover{transform:scale(1.2)}"), n(".battlesList li", function(e) {
- var t = angular.element(e).scope().campaign;
- t.is_rw && e.querySelectorAll(".country_flags").forEach((e, n) => e.outerHTML = '<a class="RWQuickLink" href="/' + q + "/military/battlefield-choose-side/" + t.id + "/" + t[n ? "def" : "inv"].id + '">' + e.outerHTML + "</a>")
- })), G.singleRowWars || (i("#header{position:sticky;top:0;z-index:9;background:#fff}#div_b{visibility:hidden}"), n(".battlesList li", function(e) {
- 2 == e.getElementsByClassName("need_to_move").length && e.insertAdjacentHTML("beforeEnd", '<img style="position:absolute;top:8px;left:413px;height:23px" src="//www.erepublik.net/images/modules/_icons/battle_listing/move_icon.png">'), e.style = "padding:5px 4px 3px;height:33px", e.querySelector(".county").style = "left:440px;top:13px;text-align:left;width:270px!important", e.querySelector(".countyTime").style = "position:absolute;top:3px;right:100px;padding:2px 13px 2px 32px;background-position:10px 3px;height:15px"
- }), n(".revamp", e => e.style = "width:150px!important"), n(".dictatorship_score_bkg,.liberation_score_bkg", e => e.style = "left:144px;top:1px"), n(".icons_battles", function(e) {
- e.style = "right:195px;top:5px", e.src.includes("cold_war") && e.remove()
- }), n(".resistance_sign", e => e.style = "position:absolute;top:-31px;left:45px;width:20px;height:20px"), n(".mpp_sign", e => e.style = "position:absolute;top:-20px;left:24px;width:17px;height:17px" + (e.classList.contains("two") ? ";left:-17px" : "")), n(".influence_multiplier", e => e.style = "position:absolute;bottom:8px;left:" + (e.parentNode.parentNode.classList.contains("attacker_holder") ? "75" : "-110") + "px"), n(".specialBtns", e => e.style = "top:3px;right:400px"), n(".country_flags", function(e) {
- e.title = e.className.split(" ")[1].replace(/-/g, " "), s(e, "n")
- }), n(".combat_missions,.war_details_text,.attacker_holder>strong,.opponent_holder>strong,.dict_war_icon,.libe_war_icon,.need_to_move,.list_allCO", e => e.remove())), G.getPoints || function() {
- function e(e) {
- var n = "";
- return t(e, (e, t) => n += t.citizenName + " <span>" + t.value + "</span><br>"), n
- }
- i("#stuffTipsy tr:last-child td{text-align:left;vertical-align:text-top;padding:2px 5px}#stuffTipsy tr:last-child span{float:right;margin:0 0 0 5px}#stuffTipsy td{padding:1px}"), n(".war_versus_img", function(n) {
- s(n, "ns", function(i) {
- var o, a = angular.element(n).scope().campaign,
- r = a.inv.id;
- return n.orgTitle || (o = setTimeout(function() {
- B(a.selectedBattleZoneId, function(o) {
- var l = '<table style="background:rgb(0,0,0,.7);color:#fff;text-shadow:0 0 2px #000;font-weight:700;margin:-5px;border-radius:1px"><tr><td>Dom</td><td>Wall</td><td>Round ' + a.zone_id + "</td><td>Wall</td><td>Dom</td></tr>";
- t(a.div, function(e, t) {
- var n = function(e, t, n) {
- var i = e.div[t].wall;
- return i.for == n ? i.dom : 100 - i.dom
- }(a, e, r);
- l += "<tr " + (e == a.selectedBattleZoneId ? 'style="background:#83B70B"' : "") + "><td>" + t.dom_pts.inv + "</td><td>" + n.toFixed(2) + "%</td><td>" + (2 == t.epic ? "Epic" : 1 == t.epic ? "Full" : "Cold") + "</td><td>" + (100 - n).toFixed(2) + "%</td><td>" + t.dom_pts.def + "</td></tr>"
- }), de.innerHTML = n.orgTitle = l + '<tr><td colspan="2">' + e(o[a.is_dict || a.is_lib ? 255 : r].fighterData) + '</td><td></td><td colspan="2">' + e(o[a.def.id].fighterData) + "</td></tr></table>", i()
- })
- }, 300)), n.addEventListener("mouseleave", () => clearTimeout(o)), n.orgTitle || "Loading data..."
- })
- })
- }(), G.epicSensor || O(), G.showMPPs || function() {
- i(".MPP{position:absolute;bottom:13px;z-index:2;background:#83b70b;border-radius:15px;color:#fff;font:700 10px/15px Arial;width:16px;text-align:center;cursor:default}.MPPleft{left:61px}.MPPright{left:338px}.MPPtooltip{text-align:left;padding-bottom:1px;margin-top:3px}.MPPtooltip span{vertical-align:middle;margin:-2px 3px 0 0}");
- var e = battleListingScope.campaigns.countries;
- n(".battlesList li", function(t) {
- var n = angular.element(t).scope().campaign;
- n.is_rw || n.is_dict || n.is_lib || (t.insertAdjacentHTML("afterBegin", '<span class="MPP MPPleft">12</span><span class="MPP MPPright">8</span>'), t.querySelectorAll(".MPP").forEach(function(t, i) {
- var o = n[i ? "def" : "inv"].ally_list;
- o.sort((t, n) => e[t.id].name.localeCompare(e[n.id].name));
- var a = '<div class="MPPtooltip">Deployed allies</div>',
- r = 0;
- for (let t of o) t.deployed && (a += '<div class="MPPtooltip"><span class="country_flag_elem fl_small flag' + j.info.countries[t.id].permalink + '"></span>' + e[t.id].name + "</div>", r++);
- t.textContent = r, t.title = r ? a : "No deployed allies", s(t, i ? "e" : "w")
- }))
- })
- }(), G.replaceWaitingwithCountdown || (e = battleListingScope.campaigns.misc.request_time, n(".battlesList li", function(t) {
- var n = angular.element(t).scope().campaign.start - e;
- n > 0 && (t.querySelector(".countyTime").innerHTML = "<span><span>", h(t.querySelector(".countyTime span"), n, e => e.textContent = "00h:00m"))
- })), G.mercFF || F(), G.battleFilter || function() {
- function e(e) {
- t = [], r.value = "", a.forEach(function(n) {
- var i = battlesByType[e.target.filter].includes(+n.dataset.battleId);
- n.style.display = i ? "" : "none", i && t.push(n)
- }), n(".battlesList", e => e.style.display = e.querySelectorAll("li:not([style*=none])").length ? "" : "none"), G.battleFilter_lastView = e.target.filter, d();
- var i = document.querySelector(".battlesList li:not([style*=none])"),
- o = document.getElementById("mercFFdiv");
- i && o && (i.appendChild(o), o.querySelectorAll("span").forEach(e => e.style.background = getComputedStyle(i).getPropertyValue("border-top-color"))), n("#battleFilters div", t => t.innerHTML = e.target.innerHTML)
- }
- i("#battleFilters{background:#83b70b;font:700 11px/14px Arial;width:150px;position:absolute;top:5px;z-index:5;text-shadow:0 0 2px #000}#battleFilters:hover a{display:block}#battleFilters a,#battleFilters div{text-decoration:none;cursor:pointer;color:#fff;display:none;padding:3px 7px}#battleFilters a:hover{background:#fb7e3d}#battleFilters div{border-bottom:1px solid #fff;display:block}#battleFilters span{float:right;background:#fb7e3d;display:block;width:20px;text-align:center;margin:-3px -7px;padding:3px}#battle_listing{padding-top:25px}#battleSearch{position:absolute;left:160px;top:6px;padding:2px;width:70px;text-align:center;font:200 11px/14px Arial;border:1px solid #e5e5e6;border-top:1px solid #cecfcf;border-bottom:1px solid rgba(242,242,242,.9);border-radius:1px;box-shadow:inset 0 4px 12px -3px rgba(0,0,0,.1);z-index:2}#battleSearch:focus{width:210px}"), n("#battle_listing", e => e.insertAdjacentHTML("afterBegin", '<div id="battleFilters"><div></div><a value="none">All Battles<span></span></a><a value="noTravel">No Travel Needed<span></span></a><a value="ground">Ground Battles<span></span></a><a value="air">Air Battles<span></span></a><a value="mpp">Direct Battles<span></span></a><a value="epic">Full Scale & Epic<span></span></a><a value="dict">Coups & Revolutions<span></span></a><a value="as">Airstrikes<span></span></a><a value="tp">True Patriot<span></span></a><a value="rw">Resistance Wars<span></span></a>' + (G.mercFF ? "" : '<a value="merc">Mercenary<span></span></a>') + '<a value="dailyOrder">Daily Orders<span></span></a></div><input id="battleSearch" type="text" placeholder="Search Battles (country or region name)">')), battlesByType = {
- none: [],
- noTravel: [],
- air: [],
- ground: [],
- mpp: [],
- rw: [],
- dict: [],
- as: [],
- tp: [],
- epic: [],
- merc: [],
- dailyOrder: []
- };
- var t, o = z.dailyOrders.map(e => e.battleId),
- a = n(".battlesList li", function(e) {
- var t = angular.element(e).scope().campaign,
- n = "aircraft" == t.type;
- battlesByType.none.push(t.id), t.def.needToMove && t.inv.needToMove || battlesByType.noTravel.push(t.id), n ? battlesByType.air.push(t.id) : battlesByType.ground.push(t.id), t.is_rw || t.is_dict || t.is_lib || battlesByType.mpp.push(t.id), t.is_rw && battlesByType.rw.push(t.id), (t.is_dict || t.is_lib) && battlesByType.dict.push(t.id), t.is_as && battlesByType.as.push(t.id), t.inv.id != z.country && t.def.id != z.country || battlesByType.tp.push(t.id), N(t)[0] && battlesByType.epic.push(t.id), o.includes(t.id) && battlesByType.dailyOrder.push(t.id)
- }),
- r = document.getElementById("battleSearch");
- n("#battleFilters a", function(t) {
- t.filter = t.getAttribute("value"), t.querySelector("span").textContent = battlesByType[t.filter].length, t.addEventListener("click", e), t.filter == (G.battleFilter_lastView || "none") && t.click()
- }), r.addEventListener("keyup", e => {
- for (let o of t) {
- var n = angular.element(o).scope().campaign,
- i = e.target.value.toLowerCase();
- o.style.display = n.region.name.toLowerCase().includes(i) || n.def.cname.toLowerCase().includes(i) || n.inv.cname.toLowerCase().includes(i) ? "" : "none"
- }
- })
- }())
- });
- else if (oe) {
- if (i("#battleConsole li b,#battleConsole li div,#battleConsole li i,.player_name a{pointer-events:none}"), localStorage.hasMaverick = SERVER_DATA.canSwitchDivisions, e.push(function(e, t) {
- !/fight-shoo|deploy-bomb|deployReportData/.test(t) || e.error || "ENEMY_KILLED" != e.message && "OK" != e.message && !e.data || D(e)
- }), G.battlefield || function() {
- function r() {
- l("/" + q + "/military/battle-console", {
- battleId: oe,
- zoneId: SERVER_DATA.zoneId,
- action: "battleConsole",
- _token: csrfToken
- }, function(e) {
- p.textContent = e.division[currentDivision - 1].epicBattleProgress, (100 == p.textContent || SERVER_DATA.points.defender >= 1800 || SERVER_DATA.points.attacker >= 1800) && p.click()
- })
- }
- function s() {
- B(SERVER_DATA.battleZoneId, e => n("#topLists", t => t.innerHTML = '<div style="left:0">' + c(e, 1) + '</div><div style="right:0">' + c(e) + "</div>"))
- }
- function c(e, n) {
- var i = "";
- return t(e[SERVER_DATA[(n ? "left" : "right") + "BattleId"]].fighterData, function(e, t) {
- e < 11 && (i += '<a href="/' + q + "/citizen/profile/" + t.citizenId + '"><q>' + t.citizenName + "</q><span>" + a(t.raw_value, 2) + "</span></a>")
- }), i
- }
- if (i("#epicPercent,#roundNumber,#switchSide{color:#fff;position:absolute}#personal_stats,#roundNumber{text-align:center;width:100%}#switchSide{top:1px;background:#83b70b;padding:3px;font:700 11px Arial;z-index:5;right:37px;text-shadow:0 0 2px #000}#switchSide:hover{background:#fb7e3d;cursor:pointer}#epicPercent{bottom:1px;left:0;background:rgba(0,0,0,.4);font:700 10px/13px Arial;padding:2px 5px;border-radius:0 2px 0 0;cursor:pointer;text-shadow:0 0 2px #000}#epicPercent input{margin:0 5px 0 2px;top:2px;position:relative}#pvp .campaign_details .entry:not(.isInactive) em{opacity:1}#pvp .campaign_details .entry .pdomi_left em{right:5px}#roundNumber{top:7px;font:13px ds-digitalbold_italic}#personal_stats{top:" + (SERVER_DATA.webDeployEnabled ? 9 : 7) + "px;cursor:default;position:absolute;color:#ffe49b;font:700 11px Arial}.mu_pic~p~p span{color:#ffe49b}#pointsLeft,#pointsRight{color:#ffd479;font:700 11px Arial;position:absolute;top:67px;z-index:120}#pointsLeft{left:330px}#pointsRight{right:331px}#travelButtons{position:absolute;bottom:17px;left:0;width:100%;height:20px;text-align:center;color:#fff;pointer-events:none;z-index:999}#travelButtons span{background:rgba(0,0,0,.6);margin:160px;padding:10px;border-radius:5px;cursor:pointer;font:700 10px/20px Arial;box-shadow:0 0 5px #fff;pointer-events:visible}#travelButtons span:hover{background:#000}#travelButtons img{vertical-align:middle;margin:0 5px;width:20px}#topLists div{position:absolute;top:40px;z-index:11;border-radius:2px}#topLists a{text-shadow:0 0 2px #000;font:700 9px Arial;color:#fff;display:flex;width:121px;background:rgba(0,0,0,.3);padding:2px}#topLists a:hover{color:#83b70b}#topLists q{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#topLists span{color:#ffd479}"), SERVER_DATA.spectatorOnly || n(SERVER_DATA.webDeployEnabled ? ".totalDamage" : "#total_damage", function(e) {
- e.style.visibility = "hidden";
- var t = document.cookie.split(SERVER_DATA.battleZoneId + "-" + SERVER_DATA.leftBattleId + "=")[1];
- savedStats = (t ? t.split(";")[0] : "0|0").split("|"), savedStats[2] = e.querySelector("strong").textContent.replace(/,/g, ""), e.insertAdjacentHTML("afterEnd", '<div id="personal_stats"><q>' + o(savedStats[0]) + "</q> | <q>" + o(savedStats[1]) + "</q> | <q>" + o(savedStats[2]) + "</q></div>"), personal_stats = n("#personal_stats q")
- }), ne) {
- n("#drop_part,#special_weapons_go.disabled" + (SERVER_DATA.canSwitchDivisions || SERVER_DATA.onAirforceBattlefield ? "" : ",.switch_region_area"), e => e.remove()), document.cookie = "collection_full=1", clearInterval(globalSleepInterval), n("#pvp", e => e.insertAdjacentHTML("beforeEnd", (SERVER_DATA.onAirforceBattlefield ? "" : '<label id="epicPercent"><input type="checkbox">Epic progress <span></span>%</label>') + (SERVER_DATA.isCivilWar || SERVER_DATA.spectatorOnly ? "" : '<a id="switchSide">Switch side >></a>') + '<div id="roundNumber">Round ' + SERVER_DATA.zoneId + '</div><div id="pointsLeft"></div><div id="pointsRight"></div><div id="topLists"></div>' + (!SERVER_DATA.isCivilWar && SERVER_DATA.spectatorOnly ? '<div id="travelButtons"><span><img src="//www.erepublik.net/images/flags_png/L/' + j.info.countries[SERVER_DATA.leftBattleId].permalink + '.png">Join</span><span>Join <img src="//www.erepublik.net/images/flags_png/L/' + j.info.countries[SERVER_DATA.rightBattleId].permalink + '.png"></span></div>' : ""))), n("#switchSide", e => e.addEventListener("click", () => R(oe, SERVER_DATA.battleZoneId, SERVER_DATA.rightBattleId))), SERVER_DATA.isResistance && n("#region_name_link", e => e.textContent += " [RW]");
- var d, p = document.querySelector("#epicPercent span");
- n("#epicPercent input", e => e.addEventListener("change", function() {
- this.checked ? (r(), d = setInterval(r, 6e4)) : clearInterval(d)
- })), !SERVER_DATA.isCivilWar && SERVER_DATA.spectatorOnly && n("#travelButtons span", (e, t) => e.addEventListener("click", () => R(oe, SERVER_DATA.battleZoneId, t ? SERVER_DATA.rightBattleId : SERVER_DATA.leftBattleId)));
- var u = angular.element("#battleFooterbattleSetup").scope(),
- f = u.openPopup;
- u.openPopup = (() => {}), setTimeout(() => u.openPopup = f, 2e3), n(".battle_heroes", e => e.style.display = "none"), s(), setInterval(function() {
- SERVER_DATA.points.attacker < 1800 && SERVER_DATA.points.defender < 1800 && s()
- }, 3e4);
- var g = n("#pointsLeft,#pointsRight");
- e.push(function(e, t) {
- if (t.includes("battle-stats")) {
- e.division && g.forEach((t, n) => t.textContent = e.division[SERVER_DATA[n ? "rightBattleId" : "leftBattleId"]].total);
- var n = e.battle_zone_situation[SERVER_DATA.battleZoneId];
- n && (document.title = (n > 1 ? "EPIC BATTLE" : "FULL SCALE") + " DETECTED")
- }
- })
- }
- }(), G.autoBot || SERVER_DATA.spectatorOnly || function() {
- function e() {
- "AUTOBOT ON" == c[0].textContent && (a(u.value < 3 && !d[0].checked ? 2500 : 1e3), globalNS.userInfo.wellness >= f.value ? l("/" + q + "/military/fight-shoo" + (SERVER_DATA.onAirforceBattlefield ? "oo" : "o") + "t/" + oe, {
- sideId: SERVER_DATA.countryId,
- battleId: oe,
- _token: csrfToken
- }, function(e) {
- ["UNKNOWN_SIDE", "WRONG_SIDE"].includes(e.message) && (location.href = e.url), ["ENEMY_ATTACKED", "LOW_HEALTH"].includes(e.message) ? (window.globalNS.userInfo.wellness = 0, a(0)) : "ZONE_INACTIVE" == e.message ? t() : "SHOOT_LOCKOUT" == e.message ? a(450) : (battleFX.updateRank(e.rank), window.totalPrestigePoints += e.hits, m.forEach(e => e.textContent = totalPrestigePoints), b.forEach(t => t.textContent = o(e.details.currency)), h.forEach(function(t) {
- t.style.width = e.details.current_energy_ratio + "%", t.classList.remove("high", "medium", "low"), t.classList.add(e.details.current_energy_ratio < 20 ? "low" : e.details.current_energy_ratio > 60 ? "high" : "medium")
- }), e.user.weaponQuantity >= 0 && v.forEach(t => t.textContent = o(e.user.weaponQuantity)), globalNS.updateSideBar(e.details), d[0].checked || 1 != (u.value = u.value - 1) || a(900), (!p.checked && !food_remaining && globalNS.userInfo.wellness < f.value || u.value <= 0 && !d[0].checked || g.checked && !e.user.epicBattle) && t(), D(e))
- }) : E() || p.checked ? r("/" + q + "/main/eat?format=json&_token=" + csrfToken + "&buttonColor=" + (p.checked ? "orange" : "blue"), function(e) {
- energy.processResponse(e), a(1e3)
- }) : t())
- }
- function t() {
- c[0].textContent = "AUTOBOT OFF", c[0].style.background = "#FB7E3D", clearTimeout(s)
- }
- function a(t) {
- clearTimeout(s), s = setTimeout(e, t)
- }
- var s;
- i("#AutoBot,#AutoBot img{position:absolute;background:rgba(36,43,39,.6)}#AutoBot{transition:left .3s;width:136px;left:-136px;top:240px;border-radius:3px;color:#fff;font:700 12px/20px Arial;text-align:left;z-index:10;text-shadow:0 0 2px #000}#AutoBot input{width:25px;margin:3px 1px;text-align:center}#AutoBot input[type=number]{width:60px;text-align:right;position:absolute;right:5px;margin:0}#AutoBot div{padding:5px}#AutoBot img{width:36px;height:36px;padding:0 6px;top:40%;right:-48px;cursor:pointer;border-radius:0 3px 3px 0}#AutoBot img:hover{filter:brightness(1.2)}#AutoBotSwitch{cursor:pointer;width:100%;background:#FB7E3D;text-align:center}#AutoBotSwitch:hover{background:#83B70B!important}"), n(".battle_footer", e => e.insertAdjacentHTML("afterEnd", '<div id="AutoBot"><div><label>Kills:<input id="kills" type="number" value="25" min="1"></label><br><label><input id="allin" type="checkbox">All-in</label><label><input id="eatEB" type="checkbox">Eat EBs</label><br><label>Min HP:<input id="minEnergy" type="number" value="50" step="10" min="0"></label><br><label><input id="stopNoEpic" type="checkbox">Stop if no epic</label><br><label><input id="freezeBattlefield" type="checkbox">Freeze battlefield</label><br></div><p id="AutoBotSwitch">AUTOBOT OFF</p><img src="//www.erepublik.net/images/emoji/emojione/color/1f52b.png"></div>'));
- var c = n("#AutoBotSwitch", n => n.addEventListener("click", function() {
- "AUTOBOT OFF" == n.textContent ? (n.textContent = "AUTOBOT ON", n.style.background = "#83B70B", e()) : t()
- })),
- d = n("#allin", e => e.addEventListener("change", () => u.disabled = e.checked)),
- p = document.getElementById("eatEB"),
- u = document.getElementById("kills"),
- f = document.getElementById("minEnergy");
- !ne && G["kills" [2]][V] > 7500 && re > 4400 && (d[0].checked = !0, p.checked = !0, f.value = reset_health_to_recover - 10);
- var g = document.getElementById("stopNoEpic"),
- m = n("#prestige_value"),
- b = n("#side_bar_currency_account_value"),
- h = n(".left_player .energy_progress"),
- v = n(".weapon_no");
- document.querySelector("#AutoBot img").addEventListener("click", e => e.target.parentElement.style.left = "0px" == e.target.parentElement.style.left ? "-136px" : "0px"), document.getElementById("freezeBattlefield").addEventListener("click", e => ERPK.initPlayerRateFilter(e.target.checked ? "Off" : "On"))
- }(), G.mercFF || SERVER_DATA.isCivilWar || !ne || F(), U && SERVER_DATA.webDeployEnabled) var pe = setInterval(function() {
- SERVER_DATA.sessionValidation && (clearInterval(pe), H())
- }, 1e3)
- } else /donate-|accounts|citizen-friends/.test(location.href) && !G.improveProfile ? P() : location.href.includes("citizen/profile") ? g("/citizen-profile-json/", function() {
- window.hasRunProfileStuff || (window.hasRunProfileStuff = 1, G.improveProfile || P(), G.influenceCalculator || function() {
- function e() {
- o.forEach(function(e, n) {
- e.querySelectorAll("span").forEach(e => e.remove());
- var i = t.military.militaryData[n ? "aircraft" : "ground"],
- o = +e.getElementsByTagName("select")[0].value,
- r = document.getElementById("InfCalc_NE").checked,
- l = t.loggedIn.hovercardData.fighterInfo[n ? "aviation" : "military"].damagePerHitNoWeapon * (1 + o / 5) * (n ? 1 : 1 + parseInt(document.getElementById("InfCalc_legend").value) / 100) * (1 + parseInt(document.getElementById("InfCalc_booster").value) / 100),
- s = 1e6 / l;
- e.insertAdjacentHTML("beforeEnd", "<span>Influence</span><span>" + a(parseInt(l * document.getElementById("InfCalc_hits").value * (r ? 1.1 : 1)), 1) + "</span><span>Hits to next rank</span><span>" + (i.nextRankAt - i.points > 0 ? a(Math.ceil(10 * (i.nextRankAt - i.points) / l / (document.getElementById("InfCalc_WarStash").checked ? 1.1 : 1)), 1) : "∞") + '</span><span>Cost cc/M</span><span title="Includes food">' + a(((o ? G.infCalc[n ? 23 : 2][Math.min(o, 7)] / o * s : 0) + s * G.infCalc.cheapestFood * 10) / (r ? 1.1 : 1), 2) + "</span>")
- })
- }
- i("#infCalc{font-size:11px;color:#666;margin:0 0 5px;width:577px;text-align:center}#InfCalc_hits,#InfCalc_legend,#InfCalc_booster{padding:4px;text-align:center;width:35px;font-size:11px;margin:0 5px}#infCalc label{margin:0 5px}#InfCalc_NE,#InfCalc_WarStash{margin-left:5px;position:relative;top:2px;text-align:center}.infCalcResults{line-height:0}.infCalcResults span{width:100%;text-align:center;display:block;font:700 12px/15px Arial;color:#595959}.infCalcResults span:nth-child(even){font:400 11px/14px Arial;color:#81827f}.infCalcResults select{margin:2px;font-size:11px;padding:2px 4px;text-align:center;height:23px}.citizen_military_box_wide{width:293px;margin:0 1px 2px}.citizen_military_box_wide .rank_box{right:0}.citizen_military_box_wide .rank_icon{left:7px}.citizen_military_box_wide .regular_rank_img{margin-left:7px}.citizen_military_box_wide .rank_name_holder{width:230px;left:88px}.citizen_military_box .military_box_info{width:85px}.citizen_military_box_wide .top_area{padding:0 15px 0 77px}");
- var t = angular.element("#str_progress").scope().data;
- n(".citizen_military_box_wide", e => e.insertAdjacentHTML("afterEnd", '<div class="citizen_military_box infCalcResults"><select></select></div>'))[1].nextSibling.insertAdjacentHTML("afterEnd", '<div id="infCalc" class="citizen_military"><label>Hits <input type="text" id="InfCalc_hits" value="1"></label><label>Natural Enemy <input type="checkbox" id="InfCalc_NE"></label><label title="+10% rank points">War Stash <input type="checkbox" id="InfCalc_WarStash" ' + (t.activePacks.war_stash ? "checked" : "") + '></label><label>Damage Booster<input type="text" id="InfCalc_booster" value="0%"></label><label>Legend Bonus<input type="text" id="InfCalc_legend" value="' + Math.max(100 * t.loggedIn.hovercardData.fighterInfo.military.damagePerHitLegend / t.loggedIn.hovercardData.fighterInfo.military.damagePerHit - 100, 0).toFixed() + '%"></label></div>'), n(".citizen_military_box", e => e.style = "margin:0 1px 2px 1px;width:85px"), G.infCalc = G.infCalc || {
- 1: {},
- 2: {},
- 23: {},
- cheapestFood: 0,
- selWep: {
- 0: 7
- },
- noData: 1
- };
- var o = n(".infCalcResults", (t, n) => t.querySelectorAll("select").forEach(function(t) {
- for (var i = "", o = 0; o < 8; o++) i += !o || G.infCalc.noData || G.infCalc[n ? 23 : 2][Math.min(o, 7)] ? '<option value="' + (o < 7 ? o : 10) + '" ' + (G.infCalc.selWep[n] == o ? "selected" : "") + ">Q" + o + "</option>" : "";
- t.innerHTML = i, t.addEventListener("change", function() {
- G.infCalc.selWep[n] = Math.min(this.value, 7), d(), e()
- })
- }));
- e(), n("#InfCalc_hits,#InfCalc_legend,#InfCalc_booster", t => t.addEventListener("keyup", e)), n("#InfCalc_NE,#InfCalc_WarStash", t => t.addEventListener("change", e)), G.infCalc.date != re && u(35, function() {
- for (var t = 1; t < 4; t++)
- for (var n = 1; n < 8; n++) G.infCalc[t < 3 ? t : 23][n] = ((ce[35][f(t < 3 ? t : 23)]["q" + n] || [])[1] || {}).gross / (1 == t ? 2 * (n < 7 ? n : 10) : 1);
- G.infCalc.cheapestFood = Math.min(999, ...Object.values(G.infCalc[1])), G.infCalc.date = re, G.infCalc.noData = 0, d(), e()
- })
- }())
- }) : location.href.includes("economy/marketplace") ? location.href.includes("/offer") ? (G.improveMarketplace || T(), G.autofillMarket || I()) : g("economy/marketplace", function() {
- G.improveMarketplace || T(), G.autofillMarket || I()
- }) : location.href.includes("economy/exchange-market") ? (G.autofillGold || function() {
- function e() {
- n("button[data-currency=GOLD]", function(e) {
- var t = e.previousElementSibling.previousElementSibling;
- t.value = Math.min(e.dataset.max, 10, Math.floor(100 * z.currencyAmount / e.dataset.price) / 100), t.dispatchEvent(new Event("input"))
- })
- }
- i(".exchange_offers td.ex_citizen{width:200px}.exchange_offers td.ex_buy button{max-width:unset}"), g("exchange/retrieve", e), e()
- }(), S(".e_cash", "monetary-market/gold/statistics")) : location.href.includes("economy/myCompanies") && !G.companyManager ? (G.companyManager || function() {
- i("#CompanyManager{float:right;display:none}#CompanyManager strong{position:relative;bottom:8px;right:5px;font-size:12px}#CompanyManager span{cursor:pointer;border-radius:3px}#CompanyManager span:hover{opacity:.5}#CompanyManager img{height:30px}#companies_bottom{position:sticky;bottom:0}"), n(".area h4", e => e.insertAdjacentHTML("beforeEnd", '<div id="CompanyManager"><strong>Work as Manager</strong></div>'));
- var e = document.getElementById("CompanyManager"),
- t = n(".listing.companies:not(.disabled):not(.cannotWorkAsManager):not(.cannotWorkAsManager-location)", function(t) {
- var n = t.querySelector(".area_pic > img"),
- i = n.getAttribute("src");
- e.querySelector('img[src="' + i + '"]') || e.insertAdjacentHTML("beforeEnd", '<span><img src="' + i + '" title="' + n.title + '"></span>')
- });
- e.querySelector("span") && (e.style.display = "block", n("#help_manage", e => e.remove())), n("#CompanyManager span", e => e.addEventListener("click", function(e) {
- window.pageDetails.recoverable_health.value = food_remaining;
- var i = n(".owner_work.active").length;
- t.forEach(function(t) {
- t.querySelector('.area_pic > img[src="' + e.target.getAttribute("src") + '"]') && i < Math.floor((globalNS.userInfo.wellness + Math.min(pageDetails.recoverable_health.value, pageDetails.recoverable_health_in_food)) / 10) && t.querySelectorAll(".owner_work").forEach(function(e) {
- e.classList.contains("active") || (i++, e.classList.add("active"))
- })
- }), t.forEach(e => calculateProduction(e, !0)), checkHealth(), checkTax(), calculateTotals(), warnForCritical()
- })), n(".list_group", e => e.style.boxShadow = "none")
- }(), G.showBestJobOffer || r("/" + q + "/economy/job-market-json/" + z.countryLocationId + "/1/desc", function(e) {
- e.jobs && e.jobs[0] && (e.jobs.sort((e, t) => t.netSalary - e.netSalary), n(".employer.fill h4", t => t.insertAdjacentHTML("beforeEnd", '<a href="/' + q + "/economy/job-market/" + z.countryLocationId + '" style="position:absolute;right:21px;">Highest local offer: net ' + e.jobs[0].netSalary + "cc (" + (e.jobs[0].salaryLimit > 0 ? "max " + o(e.jobs[0].salaryLimit) + "cc/day" : "no overtime limit") + ")</a>")))
- })) : location.href.includes("economy/inventory") && !G.improveInventory ? function() {
- function a() {
- p.inputs.quantity = u[0].value;
- var e = p.settings.countries[p.inputs.selectedCountry].taxes[p.inputs.selectedIndustry],
- t = p.inputs.pricePerUnit / ((100 + (e.valueAddedTax + (p.inputs.selectedCountry != z.country ? e.importTax : 0))) / 100),
- i = t * p.inputs.quantity;
- n("#TaxPerUnit", e => e.innerHTML = (p.inputs.pricePerUnit - t).toFixed(4)), n("#Net_unit", e => e.innerHTML = t.toFixed(4)), n("#Total_net", e => e.innerHTML = '<strong style="top:39px;left:410px">Total Net</strong><b style="top:46px;right:250px">' + o(i.toFixed(2)) + " " + z.currency + '</b><small style="top:70px;right:250px;left:auto;width:auto">' + o((i / G.goldPrice.price).toFixed(2)) + " g</small>")
- }
- function r() {
- document.getElementById("totalFoodHP").innerHTML = "Total food: " + o(f[0] + f[1]) + "HP"
- }
- function s() {
- u.forEach(function(e) {
- e.value = (itemAmounts[p.inputs.selectedIndustry] || {})[p.inputs.selectedQuality] || 0, e.dispatchEvent(new Event("input"))
- }), n("#marketOffers tr", function(e) {
- p.inputs.selectedIndustry == e.dataset.industry_id && p.inputs.selectedQuality == e.dataset.quality && n(".offers_price input", function(t) {
- t.value = e.querySelector(".offer_price strong").textContent, t.dispatchEvent(new Event("input"))
- })
- })
- }
- function c(e, n) {
- t(e.items[n].items, function(e, t) {
- itemAmounts[t.industryId] = itemAmounts[t.industryId] || {}, itemAmounts[t.industryId][t.quality] = t.used ? t.amount - 1 : t.amount
- })
- }
- i("#Total_netF,.Total_net,.offer_price{text-align:right}#Total_netF span,.Total_net span,.offer_price span{margin-right:1px;font-size:11px}#Total_net *{position:absolute}tfoot tr{background:#f7fcff}#totalFoodHP{float:right;margin:5px 30px 0;color:#656565}#inventory_overview #sell_offers table td:last-child{padding-left:0}#inventory_overview #sell_offers table .delete_offer{opacity:1}"), G.goldPrice = G.goldPrice || {}, G.goldPrice.date != re && l("/" + q + "/economy/exchange/retrieve/", {
- _token: csrfToken,
- page: 1,
- currencyId: 62
- }, function(e) {
- G.goldPrice.price = JSON.stringify(e).split("data-price='")[1].split("'")[0], G.goldPrice.date = re, d()
- });
- var p = angular.element("#sell_offers").scope(),
- u = n(".offers_quantity input", e => e.setAttribute("maxlength", 9)),
- f = [0, 0];
- n("#sell_offers", function(e) {
- e.addEventListener("input", a), e.addEventListener("click", function(e) {
- e.target.matches(".sell_selector *") && s(), a()
- })
- }), n(".area.storage h4:first-child strong", function(e) {
- e.insertAdjacentHTML("beforeEnd", ' <q id="freeSpace"></q>'), e.insertAdjacentHTML("afterEnd", '<span id="totalFoodHP"></span>')
- }), e.push(function(e, t) {
- if (t.includes("inventory-items")) {
- var i = angular.element("#inventoryItems").scope().inventory;
- f[0] = w(e), itemAmounts = {}, c(i, "finalProducts"), c(i, "rawMaterials"), document.getElementById("freeSpace").innerHTML = "Free space: " + o(i.status.totalStorage - i.status.usedStorage), r(), s(), a()
- }
- if (t.includes("myMarketOffers") && (n("#sell_offers th", function(e, t) {
- e.style.width = (t ? 1 == t ? 80 : 2 == t ? 140 : 3 == t ? 60 : 132 : 70) + "px", 4 == t && e.querySelectorAll("a").forEach(e => e.style = "left:10px;margin-right:20px;padding:0 10px")
- }), n(".relative", function(e, t) {
- t || (e.querySelectorAll("span.ng-binding").forEach(e => e.style.display = "none"), e.style.left = "35px", e.querySelectorAll("small").forEach(function(e) {
- e.style = "text-align:right;top:30px;left:-50px", e.insertAdjacentHTML("beforeEnd", '<br><span>Tax / unit: </span><span id="TaxPerUnit"></span><br><span>Net / unit: </span><span id="Net_unit"></span><br>')
- }))
- }), n("#sell_offers table", e => e.insertAdjacentHTML("beforeEnd", '<tfoot><tr><td colspan="3"><td id="Total_netF"></td><td colspan="2"></td></tr></tfoot>')), n(".offers_price", e => e.insertAdjacentHTML("afterEnd", '<th id="Total_net"></th>')), a()), /marketplaceActions|myMarketOffers/.test(t)) {
- n(".Total_net,.offer_price span", e => e.remove());
- var l = 0;
- f[1] = 0, n("#marketOffers tr", function(e) {
- var t = p.settings.countries[e.dataset.country_id].taxes[e.dataset.industry_id],
- n = e.querySelector(".offer_price strong").textContent / ((100 + (t.valueAddedTax + (e.dataset.country_id != z.country ? t.importTax : 0))) / 100),
- i = n * e.dataset.amount;
- l += i, e.querySelectorAll(".offer_price").forEach(function(e) {
- e.insertAdjacentHTML("beforeEnd", "<span><br>Net: " + n.toFixed(4) + " " + z.currency + "</span>"), e.insertAdjacentHTML("afterEnd", '<td class="Total_net"><strong>' + o(i.toFixed(2)) + "</strong> " + z.currency + "<br><span>" + o((i / G.goldPrice.price).toFixed(2)) + " g</span></td>")
- }), 1 == e.dataset.industry_id && (f[1] += e.dataset.amount * (e.dataset.quality < 7 ? 2 * e.dataset.quality : 20))
- }), r(), document.getElementById("Total_netF").innerHTML = "<strong>" + o(l.toFixed(2)) + "</strong> " + z.currency + "<br><span>" + o((l / G.goldPrice.price).toFixed(2)) + " g</span>"
- }
- })
- }() : location.href.includes("/article/") && location.hash.includes("comment") ? (ue = !1, e.push(function(e, t) {
- t.includes("articleComments") && !ue && (document.getElementById(location.hash.split("#")[1]) ? (location.hash = location.hash, setTimeout(function() {
- location.hash = location.hash
- }, 500), ue = !0) : n(".load-more-comments", e => e.click()))
- })) : location.href.includes("economy/job-market") ? g("job-market-json", function() {
- document.getElementById("erepDE") || (i("#erepDE{color:#83b70b;float:right;margin:0 70px 0 10px}#erepDE:hover{color:#fb7e3d}#erepDE span{color:#42a5f5}.netSalary{font-size:11px}.bestNet{color:#83b70b!important}.travelToMarket{position:absolute;top:10px;right:220px}"), n("#job_market h1", e => e.insertAdjacentHTML("beforeEnd", '<a id="erepDE" href="//erepublik.tools/en/marketplace/jobs/0/offers">eRepublik<span>.tools</span></a>'))), n(".netSalary,.travelToMarket", e => e.remove()), n(".bestNet", e => e.classList.remove("bestNet"));
- var e = [0];
- n(".salary_sorted tr", function(t) {
- var n = angular.element(t).scope().job;
- t.getElementsByClassName("jm_salary")[0].insertAdjacentHTML("beforeEnd", '<span class="stprice netSalary"><br>' + (n.salaryLimit > 0 ? "Max " + o(n.salaryLimit) + "cc/day" : "No overtime limit") + "</span>"), n.netSalary > e[0] && (e = [n.netSalary, t])
- }), e[1] && e[1].querySelector(".jm_net_salary").classList.add("bestNet");
- var t = angular.element("#job_market").scope();
- t.data.isFromThisCountry || A("#job_market h1", t.settings.currentCountryId)
- }) : location.href.includes("tokens-market") && (S("#marketplace", "game-token/statistics/price"), G.autofillMarket || g("economy/gameTokensMarketAjax", function() {
- n(".quantity_button.maximum", e => e.click())
- }));
- var ue;
- ie || G.playerTooltip || function() {
- function a(e, t) {
- return '<span style="background:' + (t ? "#83B70B" : "red") + ';padding:0 2px;border-radius:1px;font-weight:700;margin:0 1px">' + e + "</span>"
- }
- function l(e, t) {
- var n = e.location,
- i = n[t ? "residenceCountry" : "citizenshipCountry"],
- o = i.name + (t ? ", " + n.residenceRegion.name : "");
- return '<br><img src="//www.erepublik.net/images/flags_png/S/' + i.permalink + '.png">' + (t && o.length > 44 ? o.substr(0, 42) + "…" : o) + (t ? '<span style="font-family:Icons;color:' + (e.city.residenceCityId ? e.city.residenceCity.region_id == n.residenceRegion.id ? "#83B70B" : "#FB7E3D" : "#009cff") + '"> </span>' : "")
- }
- function c(e) {
- return '<div style="background:#83B70B;padding:0 2px;border-radius:1px;color:#fff;margin:0 0 2px;font-weight:700;width:19px">' + e + "</div>"
- }
- function d(e, t) {
- var n = e.military.militaryData[t ? "ground" : "aircraft"],
- i = e.loggedIn.hovercardData.fighterInfo;
- return '<div><img src="' + n.icon + '"><div><b style="width:83%;background:linear-gradient(to right,#009cff 0%,#009cff ' + n.progress + "%,#000 " + (n.progress + .1) + '%,#000 100%);display:block;margin:0 0 -15px 30px">' + (t && n.rankNumber > 69 ? "Legend" + n.name.split("Battalion")[1] : n.name) + '<span style=""></span></b><br><brown>' + (e.citizen.is_organization ? "" : t ? "Q7 hit: " + o(i.military.damagePerHit) + (i.military.damagePerHitLegend > 0 ? " (TP " + o(i.military.damagePerHitLegend) + ")" : "") : "Q0 hit: " + o(i.aviation.damagePerHitNoWeapon)) + "</brown></div></div>"
- }
- function p(e, t, n) {
- var i = n ? e.partyData : e.military.militaryUnit;
- return "<div>" + (i ? '<img src="' + i.avatar + '" style="background:#fff">' : "") + "<div><b>" + (n ? e.isPresident ? "Country President" : e.title.country ? e.title.country : e.isCongressman ? "Congressman" : e.isPartyPresident ? "Party President" : i ? "Member" : "No political activity" : i && i.leader_id == t ? "Commander" : !i || i.second_commander_1 != t && i.second_commander_2 != t ? i && JSON.stringify(i.leaders).includes(t) ? "Captain" : i ? "Soldier" : "" : "Second Commander") + "</b><br><brown>" + (i ? i.name : "No " + (n ? "political party" : "military unit")) + "</brown></div></div>"
- }
- function u(e, n, i, o) {
- var r = "";
- t(e.achievements, function(e, t) {
- r += /hardworker|supersoldier/.test(t.img) ? "" : '<div style="width:24px;display:inline-block;text-shadow:none"><img src="//www.erepublik.net/images/achievements/icon_' + t.img + (t.count ? "_on" : "_off") + '.gif" style="width:26px;margin:0 0 -5px 0"><span style="float:left;width:26px">' + (t.count > 9999 ? Math.floor(t.count / 1e3) + "k" : t.count) + "</span></div>"
- });
- var s = e.citizen,
- u = s.name.toString(),
- f = e.activePacks;
- de.innerHTML = i.orgTitle = '<div id="eRStooltip"><div style="background:rgb(30,30,30);height:84px"><img src="' + s.avatar + '" style="float:left;width:84px;height:84px;margin:0 2px 0 0;background:#fff;border-radius:5px 0 0 0"><b style="background:' + (s.level > 69 && s.nextLevelXp - e.citizenAttributes.experience_points < 500 ? "#FB7E3D" : "#83B70B") + '">' + s.level + "</b><b" + (e.isDictator ? ' style="background:rgb(204,60,0)"' : "") + ">" + (u.length < 20 ? u : u.substr(0, 18) + "…") + "</b>" + (s.onlineStatus ? '<span style="background:#83B70B;border-radius:10px;height:12px;width:12px;display:inline-block;margin:0 5px -1px;border:1px solid;box-shadow:0 0 3px"></span>' : "") + "<br>" + (s.is_organization ? a("Organization", 1) : "") + (e.friends.isFriend ? a("Friend", 1) : "") + (s.is_alive ? "" : a("Dead")) + ("Permanently" == s.banStatus.type ? a("Permaban") : s.banStatus.type ? a("Tempban") : "") + (G.contributors && G.contributors.includes(+n) ? a("Stuff++ contributor", 1) : "") + (e.isModerator ? a("Mod") : "") + "<br><brown>eR birthday: " + e.loggedIn.hovercardData.born_on + "</brown>" + l(e) + l(e, 1) + '</div><div style="position:absolute;top:2px;right:5px;text-align:center;width:20px">' + (f.power_pack ? c("PP") : "") + (f.infantry_kit ? c("IK") : "") + (f.division_switch_pack ? c("MP") : "") + (U && G.l[s.id] ? c("AF") : "") + '</div><div style="background:rgb(50,50,50);padding:0 5px;height:63px"><div>' + d(e, 1) + d(e) + "</div><div>" + p(e, n, 1) + p(e, n) + '</div></div><div style="height:47px;background:#fff;color:#5a5a5a;border-radius:0 0 5px 5px;text-align:center;font:9px/14px Arial">' + r + "</div></div>", o()
- }
- function f() {
- n('#content a[href*="zen/pro"]:not(.eRStooltipAdded)', function(e) {
- e.classList.add("eRStooltipAdded"), s(e, "ns", function(t) {
- var n, i = e.href.split("profile/")[1];
- return g[i] ? u(g[i], i, e, t) : n = setTimeout(() => r("/" + q + "/main/citizen-profile-json/" + i, function(n) {
- g[i] = n, u(g[i], i, e, t)
- }), 300), e.addEventListener("mouseleave", () => clearTimeout(n)), e.orgTitle || "Loading data..."
- })
- })
- }
- i(".citizen_activity a,.pic.tipsyElement a,.user-cmnt-avatar a{display:block}#eRStooltip{color:#fff;width:400px;font:11px/15px Arial;text-shadow:0 0 2px #000;text-align:left;margin:-7px;border:2px solid #000;border-radius:6px;box-shadow:0 0 5px #000}#eRStooltip>div>b{font:700 17px/20px Tahoma;border-radius:1px;padding:1px 2px;margin:0 1px 2px;display:inline-block}#eRStooltip>div>img:not(:first-child){margin:0 2px -4px 1px;width:14px}#eRStooltip>div:not(:last-child)>div{width:50%;float:left}#eRStooltip>div>div>div{height:30px;width:100%;float:left;margin:1px 0;overflow:hidden}#eRStooltip>div>div>div>img{width:30px;height:30px;float:left;margin:0 5px 0 0}#eRStooltip brown{color:#c3bb8c}"), angular.element("body").injector().get("hovercardDirective")[0].restrict = "E", n("[hovercard]", e => angular.element(e).scope().getCitizenData = (() => {})), n("hovercard-details", e => e.remove());
- var g = {};
- f(), te || oe || location.href.includes("/article/") ? setInterval(f, 1e3) : e.push(() => setTimeout(f, 500))
- }(), G.autoFighter || function() {
- var e = m("preferCountries").split(",").map(Number),
- n = m("avoidCountries").split(",").map(Number),
- i = !1;
- for (let e of ["battlefield", "autoBot", "energyRecovery", "autoLogin"]) G[e] && (G[e] = !1, i = !0);
- i && (d(), b("AutoFighter requires the following Stuff++ options:<br>-Improved battlefield<br>-AutoBot<br>-Automatic energy recovery<br>-Automatic login<br><br>They have been enabled for you."), addEventListener("click", () => location.reload())), parent.location.href.includes("A/u/t/o/F/i/g/h/t/e/r") && setTimeout(function() {
- function i(i, a) {
- a.length > 1 && a.push("any"), a = a.filter((e, t, n) => n.indexOf(e) == t && "none" != e && (!z.dailyOrderDone || "DO" != e));
- var r = {};
- z.countryLocationId;
- for (let e of a) r[e] = [
- [],
- []
- ];
- t(i, function(t, i) {
- if (!i.is_dict && !i.is_lib && ("both" == Y || "ground" == Y && "tanks" == i.type || "air" == Y && "aircraft" == i.type)) {
- var l = i.inv,
- s = i.def,
- c = l.id,
- d = s.id,
- p = !l.needToMove,
- u = !s.needToMove,
- f = !n.includes(c),
- g = !n.includes(d),
- m = p && f,
- b = u && g,
- h = e.includes(c) ? c : e.includes(d) ? d : f ? c : g ? d : 0,
- v = h && (c == h && p || d == h && u) ? h : 0;
- if (h)
- for (let e of a) {
- if (m || b) {
- let n = o[e](i, p, u, c, d, !1);
- if (n > -1) {
- let o = "epic" == e,
- a = o ? n : Object.keys(i.div).pop(),
- l = i.div[a].dom_pts;
- (l.inv > 0 || l.def > 0) && l.inv < 1770 && l.def < 1770 && r[e][0].push([t, a, o ? m && c == z.country ? c : b && d == z.country ? d : v : e.includes("TP") ? z.country : n > 0 ? n : v])
- }
- }
- if (X && !e.includes("NoTravel")) {
- let n = o[e](i, p, u, c, d, !0);
- if (n > -1) {
- let o = "epic" == e,
- a = o ? n : Object.keys(i.div).pop(),
- l = i.div[a].dom_pts;
- (l.inv > 0 || l.def > 0) && l.inv < 1770 && l.def < 1770 && r[e][1].push([t, a, o ? f && c == z.country ? c : g && d == z.country ? d : h : e.includes("TP") ? z.country : n > 0 ? n : h])
- }
- }
- }
- if (r[a[0]][0].length) return !1
- }
- });
- for (let e of a) {
- var l = r[e][0].concat(r[e][1])[0];
- if (l) {
- f = !0, localStorage.afKills = "DO" == e ? 25 : "epic" == e ? -1 : m("maxKills"), R(...l);
- break
- }
- }
- }
- var o = {
- epic: function(e) {
- var t = N(e);
- return 2 == t[0] ? t[1] : -1
- },
- DO: function(e, t, n, i, o, a) {
- var r = z.dailyOrders;
- if (r)
- for (let l of r)
- if (l.battleId == e.id && (t && l.sideCountryId == i || n && l.sideCountryId == o || a)) return l.sideCountryId;
- return -1
- },
- TP: (e, t, n, i, o, a) => +(o == z.country && (n || a) || i == z.country && (t || a)) - 1,
- TPrw: (e, t, n, i, o, a) => +((o == z.country && (n || a) || i == z.country && (t || a)) && e.is_rw) - 1,
- TPdirect: (e, t, n, i, o, a) => +((o == z.country && (n || a) || i == z.country && (t || a)) && !e.is_rw) - 1,
- anyNoTravel: (e, t, n) => +(n || t) - 1,
- anyNoTravelAir: (e, t, n) => +((n || t) && "aircraft" == e.type) - 1,
- anyNoTravelGround: (e, t, n) => +((n || t) && "tanks" == e.type) - 1,
- anyAir: e => +("aircraft" == e.type) - 1,
- anyGround: e => +("tanks" == e.type) - 1,
- RW: e => +e.is_rw - 1,
- any: () => 0
- };
- if (M())
- if (setTimeout(() => location.href = "/" + q + "/military/campaigns", 60 * (oe ? 15 : 5) * 1e3), top.lastCheck = Date.now(), ie) {
- var a = globalNS.userInfo.wellness + food_remaining;
- if (z.dailyTasksDone && !z.hasReward && l("/" + q + "/main/daily-tasks-reward", {
- _token: csrfToken
- }), m("collectWcRewards") && localStorage.afKills && l("/" + q + "/main/weekly-challenge-collect-all", {
- _token: csrfToken
- }), localStorage.removeItem("afKills"), z.dailyOrderDone && !z.hasDailyOrderReward && l("/" + q + "/military/group-missions", {
- action: "check",
- _token: csrfToken
- }), a > 50 && Math.abs((G.workTrainLastAttempt || -9) - t_hours) > 1) {
- var s = m("work"),
- c = m("workOvertime");
- G.workTrainLastAttempt = t_hours, d(), !z.dailyTasksDone && m("train") && r("/" + q + "/main/training-grounds-json", function(e) {
- var t = {
- _token: csrfToken
- };
- for (let n = 0; n < e.grounds.length; n++) t["grounds[" + n + "][id]"] = e.grounds[n].id, t["grounds[" + n + "][train]"] = 1;
- l("/" + q + "/economy/train", t)
- }), (s || c) && r("/" + q + "/main/job-data", function(e) {
- s && !e.alreadyWorked ? l("/" + q + "/economy/work", {
- _token: csrfToken,
- action_type: "work"
- }) : c && 1e3 * e.overTime.nextOverTime - Date.now() < 0 && e.overTime.points > 23 && l("/" + q + "/economy/workOvertime", {
- _token: csrfToken,
- action_type: "workOvertime"
- })
- })
- } else if (U && 0 !== navigator.maxTouchPoints && t_hours > 15 && (re > +localStorage.getItem("latestWaMDay") || +localStorage.getItem("captchaAttempt") < 5)) {
- var p = [364587, 2103065, 2116853, 2849368, 7560781, 12467345, 17218678, 19572382, 19931264, 19931265, 19931270, 22422640, 22422679, 22422693, 22422722, 22422805, 22422830, 22422848, 22422872, 22422889, 22422901, 22422930];
- if (a >= 10 * p.length) {
- localStorage.latestWaMDay = re;
- var u = {
- action_type: "production",
- _token: csrfToken
- };
- for (let e = 0; e < p.length; e++) u["companies[" + e + "][id]"] = p[e], u["companies[" + e + "][employee_works]"] = 0, u["companies[" + e + "][own_work]"] = 1;
- y(0, 306, 0, 0, function() {
- l("/" + q + "/economy/work", u, function(e) {
- var t = +localStorage.getItem("captchaAttempt");
- 999 == t && (t = 0), t = "captcha" == e.message || "invalid_own_works" == e.result ? t + 1 : 999, localStorage.captchaAttempt = t;
- var n = e.status && e.message,
- i = n ? "WORKED SUCCESSFULLY" + (t < 9 ? "<br>Captcha attempts: " + t : "") : JSON.stringify(e).substr(0, 500) + "<br>Captcha attempts: " + t;
- localStorage.waMLog = i, top.document.getElementById("status").innerHTML = '<div style="background:' + (n ? "#83B70B" : "red") + '">' + i + "</div>", location.href = "/" + q + "/military/campaigns"
- })
- })
- }
- } else {
- var f = !1,
- g = battleListingScope.campaigns.initialList,
- b = reset_health_to_recover * m("energyRatio");
- if (a >= b ? i(g, Z) : a > 499 && $ && Z.includes("epic") && i(g, ["epic"]), !f && U && a > ($ ? 499 : 50)) {
- var h = [],
- v = [];
- if (t(g, function(e, n) {
- if (!n.is_dict && !n.is_lib) {
- var i = [];
- if (t(n.div, function(t, o) {
- var a = o.dom_pts,
- r = Math.max(a.inv, a.def);
- if (r < 1770) {
- var l = o.div,
- s = o.stats,
- c = r > (Math.min(a.inv, a.def) < 200 ? 1600 : 1490),
- d = r > 800,
- p = l < 4 ? 22001 : 62e4;
- for (let o of ["def", "inv"]) {
- let a = s[o],
- u = a && a.citizenId != V;
- l < 5 && c && (!a || u && a.damage < p) ? i.push([n.id, t, n[o].id]) : !h.length && 4 == l && d && (!a || u && a.damage < 1e7) && v.push([t, e, r, n[o].id])
- }
- }
- }), i.length) {
- i.sort((e, t) => e[2] - t[2]);
- for (let e of i) h.push(e)
- }
- }
- }), (h = h.slice(-parseInt(a / 40))).length) {
- f = !0;
- var x = setInterval(function() {
- if (h.length) {
- var e = h.pop();
- R(e[0], e[1], e[2], 1), setTimeout(function() {
- l("/" + q + "/military/fight-shooot/" + e[0], {
- sideId: e[2],
- battleId: e[0],
- battleZoneId: e[1],
- _token: csrfToken
- })
- }, 3e3)
- } else clearInterval(x), y(W.countryId, W.regionId, 0, 0, () => {})
- }, 6e3)
- } else if (v.length && a >= .9 * b) {
- f = !0, v.sort((e, t) => t[2] - e[2]);
- var k = v[0];
- localStorage.afKills = 25, R(k[1], k[0], k[3])
- }
- }!f && m("returnToResidence") && W.hasResidence && z.regionLocationId != W.regionId && y(W.countryId, W.regionId)
- }
- } else oe && (Q && !SERVER_DATA.onAirforceBattlefield && currentWeaponId != Q ? selectWeapon(Q) : J && SERVER_DATA.onAirforceBattlefield && currentWeaponId != J && selectWeapon(J), setTimeout(function() {
- var e = +localStorage.afKills;
- if (e < 0 ? (document.getElementById("stopNoEpic").checked = !0, $ && (document.getElementById("allin").checked = !0)) : globalNS.userInfo.wellness > reset_health_to_recover && (document.getElementById("allin").checked = !0, setInterval(function() {
- globalNS.userInfo.wellness < reset_health_to_recover && location.reload()
- }, 2e3)), document.getElementById("kills").value = e < 0 ? m("maxKills") : e, M()) {
- var t = document.getElementById("AutoBotSwitch");
- t.click(), setInterval(function() {
- "AUTOBOT ON" != t.textContent && (m("returnToResidence") && W.hasResidence && z.regionLocationId != W.regionId ? setTimeout(() => y(W.countryId, W.regionId, 0, 0, () => location.href = "/" + q + "/military/campaigns"), 3e3) : location.href = "/" + q + "/military/campaigns")
- }, 2e3)
- }
- }, 3e3))
- }, 5e3)
- }(), n('#menu5 li a[href*="elections"]', function(e) {
- var t = +document.querySelector(".date").textContent.split(" ")[1];
- e.href = "/" + q + "/main/" + (t > 4 && t < 15 ? "presidential" : t > 14 && t < 25 ? "party" : "congress") + "-elections"
- })
- }
- }
- })
- }
- }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement