Advertisement
Guest User

Untitled

a guest
Nov 29th, 2019
1,461
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 128.13 KB | None | 0 0
  1. // ==UserScript==
  2. // @name eRepublik Stuff++
  3. // @author Zordacz
  4. // @version 5.4
  5. // @include https://www.erepublik.com/*
  6. // @run-at document-start
  7. // @grant none
  8. // ==/UserScript==
  9. ! function() {
  10. if (location.href.includes("A/u/t/o/F/i/g/h/t/e/r")) addEventListener("DOMContentLoaded", function() {
  11. var e = localStorage.waMLog;
  12. 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() {
  13. window.lastCheck && lastCheck + 9e5 < Date.now() && (document.getElementById("autoFighter").src = "/en/military/campaigns")
  14. }, 6e4), addEventListener("click", () => location.href = "/")
  15. });
  16. else if (top == self || parent.location.href.includes("A/u/t/o/F/i/g/h/t/e/r")) {
  17. var e = [],
  18. t = XMLHttpRequest.prototype.send;
  19. XMLHttpRequest.prototype.send = function() {
  20. this.addEventListener("load", function() {
  21. var t = "{" == this.responseText.trim()[0] ? JSON.parse(this.responseText) : this.responseText;
  22. for (let n of e) n(t, this.responseURL)
  23. }), t.apply(this, arguments)
  24. }, addEventListener("DOMContentLoaded", function() {
  25. function t(e, t) {
  26. for (let n in e)
  27. if (e.hasOwnProperty(n) && !1 === t(n, e[n])) break
  28. }
  29.  
  30. function n(e, t) {
  31. var n = document.querySelectorAll(e);
  32. return t && n.forEach((e, n) => t(e, n)), n
  33. }
  34.  
  35. function i(e) {
  36. document.head.insertAdjacentHTML("beforeEnd", "<style>" + e + "</style>")
  37. }
  38.  
  39. function o(e) {
  40. return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")
  41. }
  42.  
  43. function a(e, t) {
  44. return e > 999999999 ? (e / 1e9).toFixed(t + 1) + "B" : e > 999999 ? (e / 1e6).toFixed(t) + "M" : o(+e.toFixed(t))
  45. }
  46.  
  47. function r(e, t) {
  48. fetch(e, {
  49. credentials: "same-origin"
  50. }).then(e => e.text()).then(e => t && t("{" == e.trim()[0] ? JSON.parse(e) : e))
  51. }
  52.  
  53. function l(e, n, i) {
  54. var o = "";
  55. t(n, (e, t) => o += "&" + encodeURIComponent(e) + "=" + encodeURIComponent(t)), fetch(e, {
  56. method: "POST",
  57. headers: {
  58. "Content-Type": "application/x-www-form-urlencoded"
  59. },
  60. credentials: "same-origin",
  61. body: o
  62. }).then(e => e.text()).then(e => i && i("{" == e.trim()[0] ? JSON.parse(e) : e))
  63. }
  64.  
  65. function s(e, t, n) {
  66. function i() {
  67. de.style = "";
  68. var t = e.getBoundingClientRect(),
  69. n = e.gravity || "ns";
  70. 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"
  71. }
  72. e.gravity = t, e.addEventListener("mouseenter", function(t) {
  73. var o = e.title || e.orgtitle;
  74. de.innerHTML = n ? n(i) : o, e.orgtitle = o, e.title = "", i()
  75. }), e.addEventListener("mouseleave", () => de.style = "")
  76. }
  77.  
  78. function c(e) {
  79. r("//dl.dropboxusercontent.com/s/165fdfgga2lb3se/u.json", function(t) {
  80. G.update = re, 6365664 != V && (!G.sub || G.sub < re - 30) && (G.sub = re, l("/" + q + "/main/newspaper-subscribe", {
  81. _token: csrfToken,
  82. action: "subscribe",
  83. newspaperId: 287990
  84. })), Object.assign(G, t), C(), L(), e ? p() : d()
  85. })
  86. }
  87.  
  88. function d() {
  89. localStorage.stuff = JSON.stringify(G)
  90. }
  91.  
  92. function p() {
  93. ee = [0, 0, 0, 0], localStorage.statsToday = JSON.stringify(ee), n("#NoKills", e => e.remove())
  94. }
  95.  
  96. function u(e, t) {
  97. ce[e] ? setTimeout(t) : r("/" + q + "/economy/marketpicture/" + e, function(n) {
  98. ce[e] = n, t()
  99. })
  100. }
  101.  
  102. function f(e) {
  103. 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"
  104. }
  105.  
  106. function g(t, n) {
  107. e.push(function(e, i) {
  108. i.includes(t) && setTimeout(n)
  109. })
  110. }
  111.  
  112. function m(e) {
  113. return e in G ? G[e] : K[e]
  114. }
  115.  
  116. function b(e) {
  117. 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)
  118. }
  119.  
  120. function h(e, t, n, i) {
  121. var o = Date.now() + 1e3 * t;
  122. ! function t() {
  123. var a = (o - Date.now()) / 1e3;
  124. if (a < 1) n(e);
  125. else {
  126. var r = Math.floor(a / 3600),
  127. l = Math.floor(a % 3600 / 60),
  128. s = Math.floor(a % 60);
  129. 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)
  130. }
  131. }()
  132. }
  133.  
  134. function v() {
  135. n("#xpleft span", function(e) {
  136. var t = 5e3 - z.currentExperiencePoints % 5e3;
  137. e.textContent = t, e.style.background = t > 500 ? "#6ebce5" : "#FB7E3D"
  138. })
  139. }
  140.  
  141. function y(e, t, n, i, o) {
  142. var a = {
  143. _token: csrfToken,
  144. battleId: n || 0
  145. };
  146. e && (a.toCountryId = e), t && (a.inRegionId = t), i && (a.sideCountryId = i), l("/" + q + "/main/travel/", a, function() {
  147. o ? o() : location.reload()
  148. })
  149. }
  150.  
  151. function x(e, t) {
  152. return e < 10 && !t ? "0" + e : e
  153. }
  154.  
  155. function k(e, t) {
  156. 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);
  157. return x(parseInt(n / 3600), t) + (t ? "h " : ":") + x(parseInt(n % 3600 / 60), t) + (t ? "m" : "")
  158. }
  159.  
  160. function _(e) {
  161. return "<span class='stuffTipsySpan'>" + e + "</span><br>"
  162. }
  163.  
  164. function E() {
  165. return Math.min(reset_health_to_recover - globalNS.userInfo.wellness, food_remaining) >= smallestFood.use
  166. }
  167.  
  168. function w(e) {
  169. var n = 0;
  170. return t(e.inventoryItems.finalProducts.items, (e, t) => n += 1 == t.industryId && t.quality < 8 ? t.amount * t.attributes.energyRestore.value : 0), n
  171. }
  172.  
  173. function T() {
  174. n(".costperUse,#otherMarket,.travelToMarket", e => e.remove());
  175. var e = angular.element("#marketplace").scope(),
  176. 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],
  177. o = t[0] == z.country ? z.countryLocationId : z.country,
  178. a = document.getElementById("erepDE"),
  179. r = document.querySelector("#marketplace h1");
  180. 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() {
  181. var e = (((ce[o][f(t[1])] || {})["q" + t[2]] || [])[0] || {}).gross;
  182. 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) {
  183. e.value = o, e.dispatchEvent(new Event("change"))
  184. }))
  185. }), e.settings.can_buy || e.settings.my_offer || A("#filters_expanded", t[0]), t[1] < 2 && n("#marketplace .price_sorted tr", function(e) {
  186. var n = e.getElementsByClassName("m_price")[0];
  187. n.insertAdjacentHTML("beforeEnd", '<span class="stprice costperUse"><br>' + (parseFloat(n.textContent) / industryJSON[t[1]].attributes[t[2]].effect).toFixed(4) + " cc/hp</span>")
  188. }), n(".last", function(t) {
  189. t.title = "Page " + e.settings.totalPages, s(t)
  190. })
  191. }
  192.  
  193. function A(e, i) {
  194. 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", {
  195. check: "getCountryRegions",
  196. countryId: i,
  197. _token: csrfToken
  198. }, function(e) {
  199. var n = [0, 999];
  200. t(e.regions, function(e, t) {
  201. t.canMove && t.countryId == i && t.cost < n[1] && (n = [e, t.cost])
  202. }), n[0] ? y(i, n[0]) : humanMsg.displayMsg("Wiped country - no possible regions to travel to")
  203. })))
  204. }
  205.  
  206. function S(e, t) {
  207. 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>'))
  208. }
  209.  
  210. function I() {
  211. var e = [7, 12, 17, 24].includes(+angular.element("#marketplace").scope().settings.industryId);
  212. n(".buyField", function(t) {
  213. 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"))
  214. })
  215. }
  216.  
  217. function M() {
  218. var e = G["battleType" [4]],
  219. t = e[V];
  220. return Object.keys(e).length > 5 && t && t >= re ? t - re : 0
  221. }
  222.  
  223. function C() {
  224. var e = M(),
  225. t = e ? e + "d left" : "Expired";
  226. n(".stuffBtn+.stuffBtn span,#AF_l", (e, n) => e.textContent = n ? "License: " + t : t.split(" ")[0])
  227. }
  228.  
  229. function L() {
  230. G.version && G.version != GM_info.script.version && n(".stuffBtn,#stuffOptions>:nth-child(1) a:nth-child(3)", function(e, t) {
  231. e.style.background = "#F95555", t || (e.childNodes[0].nodeValue = "CLICK TO UPDATE")
  232. })
  233. }
  234.  
  235. function R(e, t, n, i) {
  236. var o = {
  237. _token: csrfToken,
  238. battleId: e,
  239. battleZoneId: t
  240. };
  241. n && (o.sideCountryId = n), l("/" + q + "/main/battlefieldTravel", o, () => i ? 0 : location.href = "/" + q + "/military/battlefield/" + e)
  242. }
  243.  
  244. function B(e, t) {
  245. l("/" + q + "/military/battle-console", {
  246. action: "battleStatistics",
  247. battleZoneId: e,
  248. type: "damage",
  249. leftPage: 1,
  250. rightPage: 1,
  251. _token: csrfToken
  252. }, t)
  253. }
  254.  
  255. function D(e) {
  256. var t = e.data,
  257. n = t ? +t.damage.replace(/,/g, "") : e.bomb ? e.bomb.damage : e.oldEnemy.isNatural ? Math.floor(1.1 * e.user.givenDamage) : e.user.givenDamage,
  258. i = t ? +t.rewards.prestigePoints.replace(/,/g, "") : e.hits || 1,
  259. a = t ? +t.kills.replace(/,/g, "") : 1;
  260. ee[0] += a, ee[1] += i, ee[SERVER_DATA.onAirforceBattlefield ? 3 : 2] += n, localStorage.statsToday = JSON.stringify(ee), personal_stats.forEach(function(e, t) {
  261. savedStats[t] = +savedStats[t] + (t ? t < 2 ? i : n : a), e.textContent = o(savedStats[t])
  262. }), 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))
  263. }
  264.  
  265. function F() {
  266. r("/" + q + "/main/citizen-profile-json/" + V, function(e) {
  267. 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)}");
  268. var o = e.freedomFighter,
  269. a = o.milestone.kills,
  270. r = e.achievements[11].mercenaryProgress;
  271. if (oe) {
  272. var l = 0,
  273. c = document.getElementById("region_name_link").textContent.split(" [")[0];
  274. t(o.progress.wars.inprogress, function(e, t) {
  275. t.region == c && (l = Math.min(t.kills, 75))
  276. });
  277. var d = SERVER_DATA.isResistance && (SERVER_DATA.leftBattleId == SERVER_DATA.realInvaderId || SERVER_DATA.spectatorOnly);
  278. 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")
  279. } else n(".battlesList li", function(e, n) {
  280. var i = angular.element(e).scope().campaign,
  281. l = r.details[i.inv.id].enemies_killed,
  282. s = r.details[i.def.id].enemies_killed,
  283. c = 0;
  284. if (t(o.progress.wars.inprogress, function(e, t) {
  285. t.war_id == i.war_id && (c = Math.min(t.kills, 75))
  286. }), i.is_dict || i.is_lib || e.querySelectorAll(".countyTime").forEach(function(e) {
  287. 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")
  288. }), G.battleFilter || i.is_dict || i.is_lib || "25 - 25" == e.querySelector(".countyTime div div:last-child").textContent || battlesByType.merc.push(i.id), !n) {
  289. var d = [o.progress.regions, o.milestone.regions];
  290. 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>")
  291. }
  292. }), G.battleFilter || n("#battleFilters a", function(e) {
  293. var t = e.getAttribute("value");
  294. "merc" == t && (e.querySelector("span").textContent = battlesByType.merc.length), t == G.battleFilter_lastView && e.click()
  295. });
  296. n("#mercFFdiv span,#mercenary,#freedom_fighter,.countyTime div div", e => s(e))
  297. })
  298. }
  299.  
  300. function P() {
  301. function e(t) {
  302. r("/" + q + "/main/citizen-friends/" + V + "/" + t + "/list", function(n) {
  303. (new DOMParser).parseFromString(n.content, "text/html").querySelectorAll(".dead").forEach(function(e) {
  304. var t = e.id.split("_")[1];
  305. a.includes(t) || a.push(t)
  306. }), d[0].textContent = "Scanning... " + (t / c * 100).toFixed(1) + "%", t < c ? e(t + 1) : function e() {
  307. a.length ? (d[0].textContent = "Removing... " + a.length + " left", l("/" + q + "/main/citizen-friends/" + a.pop() + "/1/remove?_token=" + csrfToken, {}, function() {
  308. s.textContent = s.textContent.replace(/\d+/, +s.textContent.match(/\d+/)[0] - 1), e()
  309. })) : (d[0].textContent = "Done!", d[0].style.background = "#83B70B")
  310. }()
  311. })
  312. }
  313. 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>");
  314. var t = +location.href.split("/")[6],
  315. o = 0;
  316. 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)) {
  317. n(".citizen_activity", function(e) {
  318. e.style.padding = 0, e.insertAdjacentHTML("beforeEnd", '<div id="removeDead">Remove dead friends</div>')
  319. });
  320. var a = [],
  321. s = document.querySelector(".friends_title a"),
  322. c = Math.ceil(s.textContent.match(/\d+/)[0] / 20);
  323. n(".view_friends", e => e.remove());
  324. var d = n("#removeDead", t => t.addEventListener("click", function() {
  325. a = [], e(1), t.style.background = "#FB7E3D"
  326. }))
  327. } else n("#donate_to_friend div", e => e.remove())
  328. }
  329.  
  330. function O() {
  331. function e(e) {
  332. t(battleListingScope.campaigns.initialList, function(t, i) {
  333. var o = N(i);
  334. 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() {
  335. event.preventDefault(), R(this.href.split("battlefield/")[1], this.getAttribute("division"))
  336. }), document.title = (e > 1 ? "EPIC BATTLE" : "FULL SCALE") + " DETECTED", !1
  337. })
  338. }
  339. var n = !1;
  340. e(2), n || e(1)
  341. }
  342.  
  343. function N(e) {
  344. var n = [],
  345. i = 0;
  346. return (!e.is_dict && !e.is_lib || G.ignoreDictatorship) && t(e.div, function(e, t) {
  347. var o = t.epic;
  348. (ae || t.div == z.division) && o && t.dom_pts.def < 1800 && t.dom_pts.inv < 1800 && o >= i && (i = o, n = [o, e])
  349. }), n
  350. }
  351.  
  352. function H() {
  353. r("/" + q + "/main/sessionUnlockPopup", function() {
  354. var e = SERVER_DATA.sessionValidation.captchaId;
  355. $j.post("/" + q + "/main/sessionGetChallenge", {
  356. _token: csrfToken,
  357. captchaId: e,
  358. env: sessionCaptcha.getEnv()
  359. }, function(t) {
  360. var n = t.sliderX || 30 + Math.round(200 * Math.random()),
  361. i = [0],
  362. o = [0];
  363. 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++)
  364. if (i[e] > n) {
  365. i.push(n), o.push(o[e] + Math.round(2 * Math.random() - 1));
  366. break
  367. } setTimeout(() => $j.post("/" + q + "/main/sessionUnlock", {
  368. _token: csrfToken,
  369. captchaId: e,
  370. src: t.src,
  371. imageId: t.imageId,
  372. challengeId: t.challengeId,
  373. sliderResult: JSON.stringify({
  374. x: i,
  375. y: o
  376. }),
  377. env: sessionCaptcha.getEnv()
  378. }, function(e) {
  379. e.verified ? location.reload() : setTimeout(H, 1e3)
  380. }), 5e3 * Math.random() + 5e3)
  381. })
  382. })
  383. }
  384. setTimeout(function() {
  385. (localStorage.scriptData || window.___RUNTIME || localStorage.ChoosenInfo) && localStorage.clear()
  386. }, 5e3);
  387. var j = window.erepublik || {},
  388. z = j.citizen || {},
  389. q = (j.settings || {}).culture || "en",
  390. W = z.residence,
  391. V = z.citizenId || 0,
  392. U = V % 397854 == 0,
  393. K = {
  394. work: !0,
  395. train: !0,
  396. workOvertime: !0,
  397. collectWcRewards: !0,
  398. returnToResidence: !0,
  399. energyRatio: 1.75,
  400. maxKills: 25,
  401. epicAllIn: !0,
  402. prefWeapGround: 7,
  403. prefWeapAir: -1,
  404. battlePrios: ["epic", "TP", "DO", "RW", "anyNoTravel"],
  405. allowTravel: !0,
  406. battleType: U || z.division < 4 ? "ground" : "both",
  407. preferCountries: "",
  408. avoidCountries: "",
  409. l: {},
  410. b: []
  411. },
  412. G = JSON.parse(localStorage.stuff || 0) || K,
  413. Q = m("prefWeapGround"),
  414. J = m("prefWeapAir"),
  415. Z = m("battlePrios"),
  416. Y = m("battleType"),
  417. X = m("allowTravel"),
  418. $ = m("epicAllIn"),
  419. ee = JSON.parse(localStorage.statsToday || "[0, 0, 0, 0]"),
  420. te = Environment.isOnHomepage,
  421. ne = top == self,
  422. ie = location.href.includes("military/campaigns"),
  423. oe = SERVER_DATA.battleId,
  424. ae = "true" == localStorage.hasMaverick;
  425. (!G.autoRefresh && te || !window.$j && !top.location.href.includes("A/u/t/o/F/i/g/h/t/e/r")) && setTimeout(() => location.href = "/", 6e5);
  426. var re = j.settings.eDay || G.update || 0,
  427. le = document.getElementsByClassName("lvl")[0],
  428. se = document.getElementById("foodResetHours"),
  429. ce = {};
  430. if (re && G.update != re && c(1), !G.b.includes(V))
  431. if (SERVER_DATA.sessionValidation) !M() || !U && ne || setTimeout(H, 5e3);
  432. else {
  433. document.body.insertAdjacentHTML("beforeEnd", '<div id="stuffTipsy"></div>');
  434. var de = document.getElementById("stuffTipsy");
  435. 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) {
  436. var t = n("#login_form input[id^=citizen_]");
  437. t[0] && t[0].value.length > 2 && t[1] && t[1].value.length > 2 && e.click()
  438. })), 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() {
  439. 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;
  440. var e;
  441. 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() {
  442. if (!e) {
  443. 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}");
  444. 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>';
  445. 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() {
  446. localStorage.clear(), location.href = "/"
  447. })), n("#stuffOptions>*", (e, t) => e.querySelectorAll("input").forEach(function(e) {
  448. var n = "checkbox" == e.type ? "checked" : "value";
  449. t ? e[n] = m(e.id) : e.checked = !G[e.id], e.addEventListener("change", function() {
  450. G[e.id] = t ? "text" == e.type ? e.value.replace(/[^0-9,]/g, "") : e[n] : !e.checked, d()
  451. })
  452. })), n("#energyRatio", function(e) {
  453. var t = e.nextSibling;
  454. e.addEventListener("input", function() {
  455. var n = (e.value * reset_health_to_recover).toFixed(0);
  456. 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"
  457. }), e.dispatchEvent(new Event("input"))
  458. }), n("#prefWeapGround,#prefWeapAir,#battleType", function(e, t) {
  459. e.value = 2 == t ? Y : t ? J : Q, e.addEventListener("change", function() {
  460. G[2 == t ? "battleType" : t ? "prefWeapAir" : "prefWeapGround"] = e.value, d()
  461. })
  462. }), n(".battlePrio", function(e, t) {
  463. e.value = Z[t], e.addEventListener("change", function() {
  464. G.battlePrios[t] = e.value, d()
  465. })
  466. })
  467. }
  468. c(), n("#stuffOptions>:nth-child(" + (o + 1) + "),#stuffBlock", e => e.style.display = "block")
  469. })), L(), G.autoFighter || document.body.insertAdjacentHTML("beforeEnd", '<div id="AFlaunch" title="Click to launch AutoFighter"><div></div></div>'), n("#AFlaunch", function(e) {
  470. s(e, "e"), e.addEventListener("click", function() {
  471. 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.")
  472. })
  473. }), C()
  474. }()) {
  475. if (z.currentExperiencePoints && window.reset_health_to_recover && (G.energyRecovery || function() {
  476. function e() {
  477. var e = document.querySelector("#AutoBotSwitch");
  478. e && "AUTOBOT ON" == e.textContent || globalNS.userInfo.wellness >= reset_health_to_recover || !E() || !smallestFood.use || SERVER_DATA.deployment || t()
  479. }
  480.  
  481. function t() {
  482. r("/" + q + "/main/eat?format=json&_token=" + csrfToken + "&buttonColor=blue", e => energy.processResponse(e))
  483. }
  484.  
  485. function o() {
  486. 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"
  487. }
  488. i(".col{line-height:19px}"), e();
  489. var a = setInterval(e, 3e3);
  490. le ? n(".energyBg", function(e) {
  491. e.addEventListener("mouseenter", () => n("#wellnessTooltipNbp", function(e) {
  492. e.querySelectorAll(".bullets").forEach(e => e.remove()), e.insertAdjacentHTML("beforeEnd", '<span class="bullets">' + o() + "<div>")
  493. })), e.addEventListener("click", t)
  494. }) : (n(".health_bg", function(e) {
  495. s(e, "w", o), e.addEventListener("click", t)
  496. }), n("#DailyConsumtionTrigger", e => e.style.display = "none")), n("#fight_btn", t => t.addEventListener("click", function() {
  497. clearInterval(a), a = setInterval(e, 3e3)
  498. }))
  499. }(), 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() {
  500. 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>'));
  501. var e = document.getElementById("maxRecover");
  502. setInterval(() => e.textContent = food_remaining, 200)
  503. }(), G.fullEnergy || setTimeout(function() {
  504. 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>'));
  505. var e = document.getElementById("full_energy");
  506. setInterval(() => e.textContent = k(), 200)
  507. })), ne && (G.externalLinks || function() {
  508. function t() {
  509. n('a[href*="/main/warn/"]', e => e.href = atob(e.href.split("/main/warn/")[1]))
  510. }
  511. e.push(function(e, n) {
  512. /\/eat|\/inventory|\/campaigns/.test(n) || t(), n.includes("main/messages") && setTimeout(t, 300)
  513. }), t()
  514. }(), G.marketLinks || function() {
  515. function e(e, t, n) {
  516. 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>")
  517. }
  518.  
  519. function t(t) {
  520. if (!t.target.querySelectorAll("a").length) {
  521. 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);
  522. 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)))
  523. }
  524. }
  525. 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}");
  526. 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);
  527. n("#newMenu", e => e.insertAdjacentHTML("beforeEnd", '<div id="marketMenu">' + o + "</div>")), n("#marketMenu", e => e.querySelectorAll("div").forEach(e => e.addEventListener("mouseenter", t)))
  528. }(), G.popupBlocker || function() {
  529. function e() {
  530. localStorage["promoPopupTimestamp_" + t.getFullYear() + "-" + t.getMonth() + "-" + t.getDate()] = 9999999999999
  531. }
  532. var t = new Date;
  533. e(), t.setDate(t.getDate() + 1), e()
  534. }()), 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) {
  535. G.displayStorage || function(e) {
  536. function c(e, t) {
  537. return e.attributes[t] ? ("energyRestore" == t ? "Energy restore" : "firePower" == t ? "Firepower" : "energyPool" == t ? "Energy pool" : "") + ": " + _(o(e.attributes[t].value)) : ""
  538. }
  539. 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}"));
  540. var d = w(e),
  541. p = 0,
  542. u = Object.assign(e.inventoryItems.finalProducts.items, e.inventoryItems.rawMaterials.items, (e.inventoryItems.activeEnhancements || {}).items || []),
  543. f = '<div id="sideInventory">';
  544. t(u, function(e, t) {
  545. if (t.icon && !t.isPartial) {
  546. var n = u[e + "_partial"],
  547. i = "4_100" == t.id && t.amount > 23 && z.dailyTasksDone && globalNS.userInfo.wellness > 9,
  548. r = t.isExpirable,
  549. l = r ? t.attributes.expirationInfo.value : 0;
  550. 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>"
  551. }
  552. isNaN(t.amount) || (p += t.amount * ("1_10" == e ? 10 : "1_11" == e ? 20 : 0))
  553. }), 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) {
  554. var n = 1e3 * t.overTime.nextOverTime - Date.now();
  555. if (n < 0) l("/" + q + "/economy/workOvertime", {
  556. _token: csrfToken,
  557. action_type: "workOvertime"
  558. }, function(t) {
  559. var n = t.status && t.message;
  560. if (humanMsg.displayMsg(n ? "Success!" : "captcha" == t.message ? "Captcha - try to work on the companies page" : "Error: " + t.message), n) {
  561. var i = e.querySelector("span");
  562. 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())
  563. }
  564. });
  565. else {
  566. var i = parseInt(n / 6e4 + 1);
  567. humanMsg.displayMsg("You must wait " + i + " minute" + (i > 1 ? "s" : "") + " before working for 10hp again")
  568. }
  569. })));
  570. var g = o(e.inventoryStatus.usedStorage) + " / " + o(e.inventoryStatus.totalStorage);
  571. 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) {
  572. e.textContent = g, e.addEventListener("click", () => n("#InfCalc_hits", function(e) {
  573. e.value = p, e.dispatchEvent(new Event("keyup"))
  574. }))
  575. }), !G.autofillMarket && location.href.includes("economy/marketplace") && I()
  576. }(e), G.damageBoosterTimer || !te && !ie || function(e) {
  577. t((e.inventoryItems.activeEnhancements || {}).items || [], function(e, t) {
  578. "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))
  579. })
  580. }(e)
  581. }), te) r("/" + q + "/military/campaignsJson/list", function(e) {
  582. battleListingScope = {
  583. campaigns: {
  584. initialList: e.battles
  585. }
  586. }, !G.epicSensor && ne && O()
  587. }), g("weekly-challenge-data", function() {
  588. 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) {
  589. e.style.display = "block", e.addEventListener("click", () => e.style.display = "none")
  590. })
  591. }), 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() {
  592. n(".postContainer:not(.autoPost)").length < 5 && n(".previousposts")[0].click()
  593. })),
  594. function() {
  595. if (ErpkShop.battlePromotions.length) {
  596. var e = "",
  597. t = ["battle_hero_promo", "sky_hero_promo", "campaign_hero_promo"];
  598. 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">');
  599. 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) {
  600. e.addEventListener("click", () => angular.element("#ErpkPopupPromosControllerPopup").scope().showPopup()), s(e)
  601. }))
  602. }
  603. }();
  604. else if (ie) G.battleFilter || n("#campaignsSearchContainer", e => e.remove()), g("campaignsJson/citizen", function() {
  605. var e;
  606. 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) {
  607. var t = angular.element(e).scope().campaign;
  608. 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>")
  609. })), G.singleRowWars || (i("#header{position:sticky;top:0;z-index:9;background:#fff}#div_b{visibility:hidden}"), n(".battlesList li", function(e) {
  610. 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"
  611. }), 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) {
  612. e.style = "right:195px;top:5px", e.src.includes("cold_war") && e.remove()
  613. }), 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) {
  614. e.title = e.className.split(" ")[1].replace(/-/g, " "), s(e, "n")
  615. }), 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() {
  616. function e(e) {
  617. var n = "";
  618. return t(e, (e, t) => n += t.citizenName + " <span>" + t.value + "</span><br>"), n
  619. }
  620. 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) {
  621. s(n, "ns", function(i) {
  622. var o, a = angular.element(n).scope().campaign,
  623. r = a.inv.id;
  624. return n.orgTitle || (o = setTimeout(function() {
  625. B(a.selectedBattleZoneId, function(o) {
  626. 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>";
  627. t(a.div, function(e, t) {
  628. var n = function(e, t, n) {
  629. var i = e.div[t].wall;
  630. return i.for == n ? i.dom : 100 - i.dom
  631. }(a, e, r);
  632. 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>"
  633. }), 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()
  634. })
  635. }, 300)), n.addEventListener("mouseleave", () => clearTimeout(o)), n.orgTitle || "Loading data..."
  636. })
  637. })
  638. }(), G.epicSensor || O(), G.showMPPs || function() {
  639. 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}");
  640. var e = battleListingScope.campaigns.countries;
  641. n(".battlesList li", function(t) {
  642. var n = angular.element(t).scope().campaign;
  643. 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) {
  644. var o = n[i ? "def" : "inv"].ally_list;
  645. o.sort((t, n) => e[t.id].name.localeCompare(e[n.id].name));
  646. var a = '<div class="MPPtooltip">Deployed allies</div>',
  647. r = 0;
  648. 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++);
  649. t.textContent = r, t.title = r ? a : "No deployed allies", s(t, i ? "e" : "w")
  650. }))
  651. })
  652. }(), G.replaceWaitingwithCountdown || (e = battleListingScope.campaigns.misc.request_time, n(".battlesList li", function(t) {
  653. var n = angular.element(t).scope().campaign.start - e;
  654. n > 0 && (t.querySelector(".countyTime").innerHTML = "<span><span>", h(t.querySelector(".countyTime span"), n, e => e.textContent = "00h:00m"))
  655. })), G.mercFF || F(), G.battleFilter || function() {
  656. function e(e) {
  657. t = [], r.value = "", a.forEach(function(n) {
  658. var i = battlesByType[e.target.filter].includes(+n.dataset.battleId);
  659. n.style.display = i ? "" : "none", i && t.push(n)
  660. }), n(".battlesList", e => e.style.display = e.querySelectorAll("li:not([style*=none])").length ? "" : "none"), G.battleFilter_lastView = e.target.filter, d();
  661. var i = document.querySelector(".battlesList li:not([style*=none])"),
  662. o = document.getElementById("mercFFdiv");
  663. 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)
  664. }
  665. 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 = {
  666. none: [],
  667. noTravel: [],
  668. air: [],
  669. ground: [],
  670. mpp: [],
  671. rw: [],
  672. dict: [],
  673. as: [],
  674. tp: [],
  675. epic: [],
  676. merc: [],
  677. dailyOrder: []
  678. };
  679. var t, o = z.dailyOrders.map(e => e.battleId),
  680. a = n(".battlesList li", function(e) {
  681. var t = angular.element(e).scope().campaign,
  682. n = "aircraft" == t.type;
  683. 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)
  684. }),
  685. r = document.getElementById("battleSearch");
  686. n("#battleFilters a", function(t) {
  687. 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()
  688. }), r.addEventListener("keyup", e => {
  689. for (let o of t) {
  690. var n = angular.element(o).scope().campaign,
  691. i = e.target.value.toLowerCase();
  692. o.style.display = n.region.name.toLowerCase().includes(i) || n.def.cname.toLowerCase().includes(i) || n.inv.cname.toLowerCase().includes(i) ? "" : "none"
  693. }
  694. })
  695. }())
  696. });
  697. else if (oe) {
  698. 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) {
  699. !/fight-shoo|deploy-bomb|deployReportData/.test(t) || e.error || "ENEMY_KILLED" != e.message && "OK" != e.message && !e.data || D(e)
  700. }), G.battlefield || function() {
  701. function r() {
  702. l("/" + q + "/military/battle-console", {
  703. battleId: oe,
  704. zoneId: SERVER_DATA.zoneId,
  705. action: "battleConsole",
  706. _token: csrfToken
  707. }, function(e) {
  708. p.textContent = e.division[currentDivision - 1].epicBattleProgress, (100 == p.textContent || SERVER_DATA.points.defender >= 1800 || SERVER_DATA.points.attacker >= 1800) && p.click()
  709. })
  710. }
  711.  
  712. function s() {
  713. 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>"))
  714. }
  715.  
  716. function c(e, n) {
  717. var i = "";
  718. return t(e[SERVER_DATA[(n ? "left" : "right") + "BattleId"]].fighterData, function(e, t) {
  719. e < 11 && (i += '<a href="/' + q + "/citizen/profile/" + t.citizenId + '"><q>' + t.citizenName + "</q><span>" + a(t.raw_value, 2) + "</span></a>")
  720. }), i
  721. }
  722. 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) {
  723. e.style.visibility = "hidden";
  724. var t = document.cookie.split(SERVER_DATA.battleZoneId + "-" + SERVER_DATA.leftBattleId + "=")[1];
  725. 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")
  726. }), ne) {
  727. 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]");
  728. var d, p = document.querySelector("#epicPercent span");
  729. n("#epicPercent input", e => e.addEventListener("change", function() {
  730. this.checked ? (r(), d = setInterval(r, 6e4)) : clearInterval(d)
  731. })), !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)));
  732. var u = angular.element("#battleFooterbattleSetup").scope(),
  733. f = u.openPopup;
  734. u.openPopup = (() => {}), setTimeout(() => u.openPopup = f, 2e3), n(".battle_heroes", e => e.style.display = "none"), s(), setInterval(function() {
  735. SERVER_DATA.points.attacker < 1800 && SERVER_DATA.points.defender < 1800 && s()
  736. }, 3e4);
  737. var g = n("#pointsLeft,#pointsRight");
  738. e.push(function(e, t) {
  739. if (t.includes("battle-stats")) {
  740. e.division && g.forEach((t, n) => t.textContent = e.division[SERVER_DATA[n ? "rightBattleId" : "leftBattleId"]].total);
  741. var n = e.battle_zone_situation[SERVER_DATA.battleZoneId];
  742. n && (document.title = (n > 1 ? "EPIC BATTLE" : "FULL SCALE") + " DETECTED")
  743. }
  744. })
  745. }
  746. }(), G.autoBot || SERVER_DATA.spectatorOnly || function() {
  747. function e() {
  748. "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, {
  749. sideId: SERVER_DATA.countryId,
  750. battleId: oe,
  751. _token: csrfToken
  752. }, function(e) {
  753. ["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) {
  754. 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")
  755. }), 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))
  756. }) : E() || p.checked ? r("/" + q + "/main/eat?format=json&_token=" + csrfToken + "&buttonColor=" + (p.checked ? "orange" : "blue"), function(e) {
  757. energy.processResponse(e), a(1e3)
  758. }) : t())
  759. }
  760.  
  761. function t() {
  762. c[0].textContent = "AUTOBOT OFF", c[0].style.background = "#FB7E3D", clearTimeout(s)
  763. }
  764.  
  765. function a(t) {
  766. clearTimeout(s), s = setTimeout(e, t)
  767. }
  768. var s;
  769. 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>'));
  770. var c = n("#AutoBotSwitch", n => n.addEventListener("click", function() {
  771. "AUTOBOT OFF" == n.textContent ? (n.textContent = "AUTOBOT ON", n.style.background = "#83B70B", e()) : t()
  772. })),
  773. d = n("#allin", e => e.addEventListener("change", () => u.disabled = e.checked)),
  774. p = document.getElementById("eatEB"),
  775. u = document.getElementById("kills"),
  776. f = document.getElementById("minEnergy");
  777. !ne && G["kills" [2]][V] > 7500 && re > 4400 && (d[0].checked = !0, p.checked = !0, f.value = reset_health_to_recover - 10);
  778. var g = document.getElementById("stopNoEpic"),
  779. m = n("#prestige_value"),
  780. b = n("#side_bar_currency_account_value"),
  781. h = n(".left_player .energy_progress"),
  782. v = n(".weapon_no");
  783. 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"))
  784. }(), G.mercFF || SERVER_DATA.isCivilWar || !ne || F(), U && SERVER_DATA.webDeployEnabled) var pe = setInterval(function() {
  785. SERVER_DATA.sessionValidation && (clearInterval(pe), H())
  786. }, 1e3)
  787. } else /donate-|accounts|citizen-friends/.test(location.href) && !G.improveProfile ? P() : location.href.includes("citizen/profile") ? g("/citizen-profile-json/", function() {
  788. window.hasRunProfileStuff || (window.hasRunProfileStuff = 1, G.improveProfile || P(), G.influenceCalculator || function() {
  789. function e() {
  790. o.forEach(function(e, n) {
  791. e.querySelectorAll("span").forEach(e => e.remove());
  792. var i = t.military.militaryData[n ? "aircraft" : "ground"],
  793. o = +e.getElementsByTagName("select")[0].value,
  794. r = document.getElementById("InfCalc_NE").checked,
  795. 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),
  796. s = 1e6 / l;
  797. 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>")
  798. })
  799. }
  800. 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}");
  801. var t = angular.element("#str_progress").scope().data;
  802. 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 || {
  803. 1: {},
  804. 2: {},
  805. 23: {},
  806. cheapestFood: 0,
  807. selWep: {
  808. 0: 7
  809. },
  810. noData: 1
  811. };
  812. var o = n(".infCalcResults", (t, n) => t.querySelectorAll("select").forEach(function(t) {
  813. 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>" : "";
  814. t.innerHTML = i, t.addEventListener("change", function() {
  815. G.infCalc.selWep[n] = Math.min(this.value, 7), d(), e()
  816. })
  817. }));
  818. 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() {
  819. for (var t = 1; t < 4; t++)
  820. 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);
  821. G.infCalc.cheapestFood = Math.min(999, ...Object.values(G.infCalc[1])), G.infCalc.date = re, G.infCalc.noData = 0, d(), e()
  822. })
  823. }())
  824. }) : location.href.includes("economy/marketplace") ? location.href.includes("/offer") ? (G.improveMarketplace || T(), G.autofillMarket || I()) : g("economy/marketplace", function() {
  825. G.improveMarketplace || T(), G.autofillMarket || I()
  826. }) : location.href.includes("economy/exchange-market") ? (G.autofillGold || function() {
  827. function e() {
  828. n("button[data-currency=GOLD]", function(e) {
  829. var t = e.previousElementSibling.previousElementSibling;
  830. t.value = Math.min(e.dataset.max, 10, Math.floor(100 * z.currencyAmount / e.dataset.price) / 100), t.dispatchEvent(new Event("input"))
  831. })
  832. }
  833. i(".exchange_offers td.ex_citizen{width:200px}.exchange_offers td.ex_buy button{max-width:unset}"), g("exchange/retrieve", e), e()
  834. }(), S(".e_cash", "monetary-market/gold/statistics")) : location.href.includes("economy/myCompanies") && !G.companyManager ? (G.companyManager || function() {
  835. 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>'));
  836. var e = document.getElementById("CompanyManager"),
  837. t = n(".listing.companies:not(.disabled):not(.cannotWorkAsManager):not(.cannotWorkAsManager-location)", function(t) {
  838. var n = t.querySelector(".area_pic > img"),
  839. i = n.getAttribute("src");
  840. e.querySelector('img[src="' + i + '"]') || e.insertAdjacentHTML("beforeEnd", '<span><img src="' + i + '" title="' + n.title + '"></span>')
  841. });
  842. e.querySelector("span") && (e.style.display = "block", n("#help_manage", e => e.remove())), n("#CompanyManager span", e => e.addEventListener("click", function(e) {
  843. window.pageDetails.recoverable_health.value = food_remaining;
  844. var i = n(".owner_work.active").length;
  845. t.forEach(function(t) {
  846. 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) {
  847. e.classList.contains("active") || (i++, e.classList.add("active"))
  848. })
  849. }), t.forEach(e => calculateProduction(e, !0)), checkHealth(), checkTax(), calculateTotals(), warnForCritical()
  850. })), n(".list_group", e => e.style.boxShadow = "none")
  851. }(), G.showBestJobOffer || r("/" + q + "/economy/job-market-json/" + z.countryLocationId + "/1/desc", function(e) {
  852. 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>")))
  853. })) : location.href.includes("economy/inventory") && !G.improveInventory ? function() {
  854. function a() {
  855. p.inputs.quantity = u[0].value;
  856. var e = p.settings.countries[p.inputs.selectedCountry].taxes[p.inputs.selectedIndustry],
  857. t = p.inputs.pricePerUnit / ((100 + (e.valueAddedTax + (p.inputs.selectedCountry != z.country ? e.importTax : 0))) / 100),
  858. i = t * p.inputs.quantity;
  859. 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>")
  860. }
  861.  
  862. function r() {
  863. document.getElementById("totalFoodHP").innerHTML = "Total food: " + o(f[0] + f[1]) + "HP"
  864. }
  865.  
  866. function s() {
  867. u.forEach(function(e) {
  868. e.value = (itemAmounts[p.inputs.selectedIndustry] || {})[p.inputs.selectedQuality] || 0, e.dispatchEvent(new Event("input"))
  869. }), n("#marketOffers tr", function(e) {
  870. p.inputs.selectedIndustry == e.dataset.industry_id && p.inputs.selectedQuality == e.dataset.quality && n(".offers_price input", function(t) {
  871. t.value = e.querySelector(".offer_price strong").textContent, t.dispatchEvent(new Event("input"))
  872. })
  873. })
  874. }
  875.  
  876. function c(e, n) {
  877. t(e.items[n].items, function(e, t) {
  878. itemAmounts[t.industryId] = itemAmounts[t.industryId] || {}, itemAmounts[t.industryId][t.quality] = t.used ? t.amount - 1 : t.amount
  879. })
  880. }
  881. 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/", {
  882. _token: csrfToken,
  883. page: 1,
  884. currencyId: 62
  885. }, function(e) {
  886. G.goldPrice.price = JSON.stringify(e).split("data-price='")[1].split("'")[0], G.goldPrice.date = re, d()
  887. });
  888. var p = angular.element("#sell_offers").scope(),
  889. u = n(".offers_quantity input", e => e.setAttribute("maxlength", 9)),
  890. f = [0, 0];
  891. n("#sell_offers", function(e) {
  892. e.addEventListener("input", a), e.addEventListener("click", function(e) {
  893. e.target.matches(".sell_selector *") && s(), a()
  894. })
  895. }), n(".area.storage h4:first-child strong", function(e) {
  896. e.insertAdjacentHTML("beforeEnd", ' <q id="freeSpace"></q>'), e.insertAdjacentHTML("afterEnd", '<span id="totalFoodHP"></span>')
  897. }), e.push(function(e, t) {
  898. if (t.includes("inventory-items")) {
  899. var i = angular.element("#inventoryItems").scope().inventory;
  900. 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()
  901. }
  902. if (t.includes("myMarketOffers") && (n("#sell_offers th", function(e, t) {
  903. 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")
  904. }), n(".relative", function(e, t) {
  905. t || (e.querySelectorAll("span.ng-binding").forEach(e => e.style.display = "none"), e.style.left = "35px", e.querySelectorAll("small").forEach(function(e) {
  906. 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>')
  907. }))
  908. }), 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)) {
  909. n(".Total_net,.offer_price span", e => e.remove());
  910. var l = 0;
  911. f[1] = 0, n("#marketOffers tr", function(e) {
  912. var t = p.settings.countries[e.dataset.country_id].taxes[e.dataset.industry_id],
  913. n = e.querySelector(".offer_price strong").textContent / ((100 + (t.valueAddedTax + (e.dataset.country_id != z.country ? t.importTax : 0))) / 100),
  914. i = n * e.dataset.amount;
  915. l += i, e.querySelectorAll(".offer_price").forEach(function(e) {
  916. 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>")
  917. }), 1 == e.dataset.industry_id && (f[1] += e.dataset.amount * (e.dataset.quality < 7 ? 2 * e.dataset.quality : 20))
  918. }), 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>"
  919. }
  920. })
  921. }() : location.href.includes("/article/") && location.hash.includes("comment") ? (ue = !1, e.push(function(e, t) {
  922. t.includes("articleComments") && !ue && (document.getElementById(location.hash.split("#")[1]) ? (location.hash = location.hash, setTimeout(function() {
  923. location.hash = location.hash
  924. }, 500), ue = !0) : n(".load-more-comments", e => e.click()))
  925. })) : location.href.includes("economy/job-market") ? g("job-market-json", function() {
  926. 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"));
  927. var e = [0];
  928. n(".salary_sorted tr", function(t) {
  929. var n = angular.element(t).scope().job;
  930. 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])
  931. }), e[1] && e[1].querySelector(".jm_net_salary").classList.add("bestNet");
  932. var t = angular.element("#job_market").scope();
  933. t.data.isFromThisCountry || A("#job_market h1", t.settings.currentCountryId)
  934. }) : location.href.includes("tokens-market") && (S("#marketplace", "game-token/statistics/price"), G.autofillMarket || g("economy/gameTokensMarketAjax", function() {
  935. n(".quantity_button.maximum", e => e.click())
  936. }));
  937. var ue;
  938. ie || G.playerTooltip || function() {
  939. function a(e, t) {
  940. return '<span style="background:' + (t ? "#83B70B" : "red") + ';padding:0 2px;border-radius:1px;font-weight:700;margin:0 1px">' + e + "</span>"
  941. }
  942.  
  943. function l(e, t) {
  944. var n = e.location,
  945. i = n[t ? "residenceCountry" : "citizenshipCountry"],
  946. o = i.name + (t ? ", " + n.residenceRegion.name : "");
  947. 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") + '">&nbsp;&nbsp;</span>' : "")
  948. }
  949.  
  950. function c(e) {
  951. return '<div style="background:#83B70B;padding:0 2px;border-radius:1px;color:#fff;margin:0 0 2px;font-weight:700;width:19px">' + e + "</div>"
  952. }
  953.  
  954. function d(e, t) {
  955. var n = e.military.militaryData[t ? "ground" : "aircraft"],
  956. i = e.loggedIn.hovercardData.fighterInfo;
  957. 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>"
  958. }
  959.  
  960. function p(e, t, n) {
  961. var i = n ? e.partyData : e.military.militaryUnit;
  962. 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>"
  963. }
  964.  
  965. function u(e, n, i, o) {
  966. var r = "";
  967. t(e.achievements, function(e, t) {
  968. 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>"
  969. });
  970. var s = e.citizen,
  971. u = s.name.toString(),
  972. f = e.activePacks;
  973. 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()
  974. }
  975.  
  976. function f() {
  977. n('#content a[href*="zen/pro"]:not(.eRStooltipAdded)', function(e) {
  978. e.classList.add("eRStooltipAdded"), s(e, "ns", function(t) {
  979. var n, i = e.href.split("profile/")[1];
  980. return g[i] ? u(g[i], i, e, t) : n = setTimeout(() => r("/" + q + "/main/citizen-profile-json/" + i, function(n) {
  981. g[i] = n, u(g[i], i, e, t)
  982. }), 300), e.addEventListener("mouseleave", () => clearTimeout(n)), e.orgTitle || "Loading data..."
  983. })
  984. })
  985. }
  986. 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());
  987. var g = {};
  988. f(), te || oe || location.href.includes("/article/") ? setInterval(f, 1e3) : e.push(() => setTimeout(f, 500))
  989. }(), G.autoFighter || function() {
  990. var e = m("preferCountries").split(",").map(Number),
  991. n = m("avoidCountries").split(",").map(Number),
  992. i = !1;
  993. for (let e of ["battlefield", "autoBot", "energyRecovery", "autoLogin"]) G[e] && (G[e] = !1, i = !0);
  994. 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() {
  995. function i(i, a) {
  996. a.length > 1 && a.push("any"), a = a.filter((e, t, n) => n.indexOf(e) == t && "none" != e && (!z.dailyOrderDone || "DO" != e));
  997. var r = {};
  998. z.countryLocationId;
  999. for (let e of a) r[e] = [
  1000. [],
  1001. []
  1002. ];
  1003. t(i, function(t, i) {
  1004. if (!i.is_dict && !i.is_lib && ("both" == Y || "ground" == Y && "tanks" == i.type || "air" == Y && "aircraft" == i.type)) {
  1005. var l = i.inv,
  1006. s = i.def,
  1007. c = l.id,
  1008. d = s.id,
  1009. p = !l.needToMove,
  1010. u = !s.needToMove,
  1011. f = !n.includes(c),
  1012. g = !n.includes(d),
  1013. m = p && f,
  1014. b = u && g,
  1015. h = e.includes(c) ? c : e.includes(d) ? d : f ? c : g ? d : 0,
  1016. v = h && (c == h && p || d == h && u) ? h : 0;
  1017. if (h)
  1018. for (let e of a) {
  1019. if (m || b) {
  1020. let n = o[e](i, p, u, c, d, !1);
  1021. if (n > -1) {
  1022. let o = "epic" == e,
  1023. a = o ? n : Object.keys(i.div).pop(),
  1024. l = i.div[a].dom_pts;
  1025. (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])
  1026. }
  1027. }
  1028. if (X && !e.includes("NoTravel")) {
  1029. let n = o[e](i, p, u, c, d, !0);
  1030. if (n > -1) {
  1031. let o = "epic" == e,
  1032. a = o ? n : Object.keys(i.div).pop(),
  1033. l = i.div[a].dom_pts;
  1034. (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])
  1035. }
  1036. }
  1037. }
  1038. if (r[a[0]][0].length) return !1
  1039. }
  1040. });
  1041. for (let e of a) {
  1042. var l = r[e][0].concat(r[e][1])[0];
  1043. if (l) {
  1044. f = !0, localStorage.afKills = "DO" == e ? 25 : "epic" == e ? -1 : m("maxKills"), R(...l);
  1045. break
  1046. }
  1047. }
  1048. }
  1049. var o = {
  1050. epic: function(e) {
  1051. var t = N(e);
  1052. return 2 == t[0] ? t[1] : -1
  1053. },
  1054. DO: function(e, t, n, i, o, a) {
  1055. var r = z.dailyOrders;
  1056. if (r)
  1057. for (let l of r)
  1058. if (l.battleId == e.id && (t && l.sideCountryId == i || n && l.sideCountryId == o || a)) return l.sideCountryId;
  1059. return -1
  1060. },
  1061. TP: (e, t, n, i, o, a) => +(o == z.country && (n || a) || i == z.country && (t || a)) - 1,
  1062. TPrw: (e, t, n, i, o, a) => +((o == z.country && (n || a) || i == z.country && (t || a)) && e.is_rw) - 1,
  1063. TPdirect: (e, t, n, i, o, a) => +((o == z.country && (n || a) || i == z.country && (t || a)) && !e.is_rw) - 1,
  1064. anyNoTravel: (e, t, n) => +(n || t) - 1,
  1065. anyNoTravelAir: (e, t, n) => +((n || t) && "aircraft" == e.type) - 1,
  1066. anyNoTravelGround: (e, t, n) => +((n || t) && "tanks" == e.type) - 1,
  1067. anyAir: e => +("aircraft" == e.type) - 1,
  1068. anyGround: e => +("tanks" == e.type) - 1,
  1069. RW: e => +e.is_rw - 1,
  1070. any: () => 0
  1071. };
  1072. if (M())
  1073. if (setTimeout(() => location.href = "/" + q + "/military/campaigns", 60 * (oe ? 15 : 5) * 1e3), top.lastCheck = Date.now(), ie) {
  1074. var a = globalNS.userInfo.wellness + food_remaining;
  1075. if (z.dailyTasksDone && !z.hasReward && l("/" + q + "/main/daily-tasks-reward", {
  1076. _token: csrfToken
  1077. }), m("collectWcRewards") && localStorage.afKills && l("/" + q + "/main/weekly-challenge-collect-all", {
  1078. _token: csrfToken
  1079. }), localStorage.removeItem("afKills"), z.dailyOrderDone && !z.hasDailyOrderReward && l("/" + q + "/military/group-missions", {
  1080. action: "check",
  1081. _token: csrfToken
  1082. }), a > 50 && Math.abs((G.workTrainLastAttempt || -9) - t_hours) > 1) {
  1083. var s = m("work"),
  1084. c = m("workOvertime");
  1085. G.workTrainLastAttempt = t_hours, d(), !z.dailyTasksDone && m("train") && r("/" + q + "/main/training-grounds-json", function(e) {
  1086. var t = {
  1087. _token: csrfToken
  1088. };
  1089. for (let n = 0; n < e.grounds.length; n++) t["grounds[" + n + "][id]"] = e.grounds[n].id, t["grounds[" + n + "][train]"] = 1;
  1090. l("/" + q + "/economy/train", t)
  1091. }), (s || c) && r("/" + q + "/main/job-data", function(e) {
  1092. s && !e.alreadyWorked ? l("/" + q + "/economy/work", {
  1093. _token: csrfToken,
  1094. action_type: "work"
  1095. }) : c && 1e3 * e.overTime.nextOverTime - Date.now() < 0 && e.overTime.points > 23 && l("/" + q + "/economy/workOvertime", {
  1096. _token: csrfToken,
  1097. action_type: "workOvertime"
  1098. })
  1099. })
  1100. } else if (U && 0 !== navigator.maxTouchPoints && t_hours > 15 && (re > +localStorage.getItem("latestWaMDay") || +localStorage.getItem("captchaAttempt") < 5)) {
  1101. var p = [364587, 2103065, 2116853, 2849368, 7560781, 12467345, 17218678, 19572382, 19931264, 19931265, 19931270, 22422640, 22422679, 22422693, 22422722, 22422805, 22422830, 22422848, 22422872, 22422889, 22422901, 22422930];
  1102. if (a >= 10 * p.length) {
  1103. localStorage.latestWaMDay = re;
  1104. var u = {
  1105. action_type: "production",
  1106. _token: csrfToken
  1107. };
  1108. 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;
  1109. y(0, 306, 0, 0, function() {
  1110. l("/" + q + "/economy/work", u, function(e) {
  1111. var t = +localStorage.getItem("captchaAttempt");
  1112. 999 == t && (t = 0), t = "captcha" == e.message || "invalid_own_works" == e.result ? t + 1 : 999, localStorage.captchaAttempt = t;
  1113. var n = e.status && e.message,
  1114. i = n ? "WORKED SUCCESSFULLY" + (t < 9 ? "<br>Captcha attempts: " + t : "") : JSON.stringify(e).substr(0, 500) + "<br>Captcha attempts: " + t;
  1115. localStorage.waMLog = i, top.document.getElementById("status").innerHTML = '<div style="background:' + (n ? "#83B70B" : "red") + '">' + i + "</div>", location.href = "/" + q + "/military/campaigns"
  1116. })
  1117. })
  1118. }
  1119. } else {
  1120. var f = !1,
  1121. g = battleListingScope.campaigns.initialList,
  1122. b = reset_health_to_recover * m("energyRatio");
  1123. if (a >= b ? i(g, Z) : a > 499 && $ && Z.includes("epic") && i(g, ["epic"]), !f && U && a > ($ ? 499 : 50)) {
  1124. var h = [],
  1125. v = [];
  1126. if (t(g, function(e, n) {
  1127. if (!n.is_dict && !n.is_lib) {
  1128. var i = [];
  1129. if (t(n.div, function(t, o) {
  1130. var a = o.dom_pts,
  1131. r = Math.max(a.inv, a.def);
  1132. if (r < 1770) {
  1133. var l = o.div,
  1134. s = o.stats,
  1135. c = r > (Math.min(a.inv, a.def) < 200 ? 1600 : 1490),
  1136. d = r > 800,
  1137. p = l < 4 ? 22001 : 62e4;
  1138. for (let o of ["def", "inv"]) {
  1139. let a = s[o],
  1140. u = a && a.citizenId != V;
  1141. 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])
  1142. }
  1143. }
  1144. }), i.length) {
  1145. i.sort((e, t) => e[2] - t[2]);
  1146. for (let e of i) h.push(e)
  1147. }
  1148. }
  1149. }), (h = h.slice(-parseInt(a / 40))).length) {
  1150. f = !0;
  1151. var x = setInterval(function() {
  1152. if (h.length) {
  1153. var e = h.pop();
  1154. R(e[0], e[1], e[2], 1), setTimeout(function() {
  1155. l("/" + q + "/military/fight-shooot/" + e[0], {
  1156. sideId: e[2],
  1157. battleId: e[0],
  1158. battleZoneId: e[1],
  1159. _token: csrfToken
  1160. })
  1161. }, 3e3)
  1162. } else clearInterval(x), y(W.countryId, W.regionId, 0, 0, () => {})
  1163. }, 6e3)
  1164. } else if (v.length && a >= .9 * b) {
  1165. f = !0, v.sort((e, t) => t[2] - e[2]);
  1166. var k = v[0];
  1167. localStorage.afKills = 25, R(k[1], k[0], k[3])
  1168. }
  1169. }!f && m("returnToResidence") && W.hasResidence && z.regionLocationId != W.regionId && y(W.countryId, W.regionId)
  1170. }
  1171. } else oe && (Q && !SERVER_DATA.onAirforceBattlefield && currentWeaponId != Q ? selectWeapon(Q) : J && SERVER_DATA.onAirforceBattlefield && currentWeaponId != J && selectWeapon(J), setTimeout(function() {
  1172. var e = +localStorage.afKills;
  1173. 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() {
  1174. globalNS.userInfo.wellness < reset_health_to_recover && location.reload()
  1175. }, 2e3)), document.getElementById("kills").value = e < 0 ? m("maxKills") : e, M()) {
  1176. var t = document.getElementById("AutoBotSwitch");
  1177. t.click(), setInterval(function() {
  1178. "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")
  1179. }, 2e3)
  1180. }
  1181. }, 3e3))
  1182. }, 5e3)
  1183. }(), n('#menu5 li a[href*="elections"]', function(e) {
  1184. var t = +document.querySelector(".date").textContent.split(" ")[1];
  1185. e.href = "/" + q + "/main/" + (t > 4 && t < 15 ? "presidential" : t > 14 && t < 25 ? "party" : "congress") + "-elections"
  1186. })
  1187. }
  1188. }
  1189. })
  1190. }
  1191. }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement