From 6f2d2625f70ddf37c946f9486d8dec6bfb8b692a Mon Sep 17 00:00:00 2001 From: peshomir Date: Fri, 8 Mar 2024 11:08:38 +0000 Subject: [PATCH] deploy: 674affb84e3df185aa3738d3509f96a5d84e2af2 --- fx_core.js | 13 ++++++++++--- game.js | 8 +++++--- index.html | 12 ++++++++---- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/fx_core.js b/fx_core.js index 9065a71..b453fb1 100644 --- a/fx_core.js +++ b/fx_core.js @@ -1,6 +1,6 @@ const dictionary = {"gIsSingleplayer":"j1","gIsTeamGame":"ha","playerId":"eu","playerNames":"k5","playerBalances":"ev","playerTerritories":"fP","uiOffset":"nf"}; -const fx_version = '0.6.1.9'; // FX Client Version -const fx_update = 'Mar 7'; // FX Client Last Updated +const fx_version = '0.6.2'; // FX Client Version +const fx_update = 'Mar 8'; // FX Client Last Updated if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) { var wins_counter = 0; @@ -96,6 +96,7 @@ var settings = { "useFullscreenMode": false, "hideAllLinks": false, "realisticNames": false, + "showPlayerDensity": true, "densityDisplayStyle": "percentage", //"customMapFileBtn": true "customBackgroundUrl": "", @@ -114,6 +115,7 @@ var settingsManager = new (function() { realisticNames: document.getElementById("settings_realisticnames"), displayWinCounter: document.getElementById("settings_displaywincounter"), useFullscreenMode: document.getElementById("settings_usefullscreenmode"), + showPlayerDensity: document.getElementById("settings_showPlayerDensity"), //customMapFileBtn: document.getElementById("settings_custommapfileinput") }; this.save = function() { @@ -294,12 +296,17 @@ function displayDonationsHistory(playerID, playerNames = getVar("playerNames"), var utils = new (function() { this.getMaxTroops = function(playerTerritories, playerID) { return (playerTerritories[playerID]*150).toString(); }; - this.getDensity = function(playerBalances, playerTerritories, playerID) { + this.getDensity = function(playerID, playerBalances = getVar("playerBalances"), playerTerritories = getVar("playerTerritories")) { if (settings.densityDisplayStyle === "percentage") return (((playerBalances[playerID] / ((playerTerritories[playerID] === 0 ? 1 : playerTerritories[playerID]) * 150)) * 100).toFixed(1) + "%"); else return (playerBalances[playerID] / (playerTerritories[playerID] === 0 ? 1 : playerTerritories[playerID])).toFixed(1); }; this.isPointInRectangle = function(x, y, rectangleStartX, rectangleStartY, width, height) { return x >= rectangleStartX && x <= rectangleStartX + width && y >= rectangleStartY && y <= rectangleStartY + height; + }; + /** @param {CanvasRenderingContext2D} canvas @param {string} text */ + this.fillTextMultiline = function(canvas, text, x, y, maxWidth) { + const lineHeight = parseInt(canvas.font.split(" ").find(part => part.endsWith("px")).slice(0, -2)); + text.split("\n").forEach((line, index) => canvas.fillText(line, x, y + index * lineHeight, maxWidth)); } }); diff --git a/game.js b/game.js index ad25413..84c0798 100644 --- a/game.js +++ b/game.js @@ -3270,7 +3270,7 @@ function bc() { } function a1F(dw) { - return dw < 3 ? ex[dw].toString() : 3 === dw || 4 === dw || 5 === dw ? ad.k3.tZ(ex[dw] / 100, 2) : dw < 7 ? ad.k3.k4(ex[dw]) : dw === 7 ? t.a0D(ex[7]) : dw === 8 ? utils.getMaxTroops(fP, eu) : utils.getDensity(ev, fP, eu) + return dw < 3 ? ex[dw].toString() : 3 === dw || 4 === dw || 5 === dw ? ad.k3.tZ(ex[dw] / 100, 2) : dw < 7 ? ad.k3.k4(ex[dw]) : dw === 7 ? t.a0D(ex[7]) : dw === 8 ? utils.getMaxTroops(fP, eu) : utils.getDensity(eu) } function a1E() { @@ -5139,12 +5139,14 @@ function bs() { gT.setTransform(v4, 0, 0, v4, jp, a99), gT.globalAlpha = a9B(fontSize), jq = 1 === iZ ? b3.uN[a8g[dw + f3]] : 2 === iZ ? i.uJ()[4].gS[dY < 255 ? 1 : 0] : (3 === iZ ? i.uJ()[5] : i.uJ()[6]).gS[0]; gT.drawImage(jq, 0, 0), gT.globalAlpha = 1, gT.setTransform(1, 0, 0, 1, 0, 0) }(jp, jq, fontSize, iZ, dw, w9, a8h[dw + iZ * f3], gT), w9 -= 2) - }(jp, jq, fontSize, dw, gT), (jr = a8W * fontSize) < a8Y || (gT.font = g1 + jr + g2, aR.k1.k2 ? a94(dw, jr, jp, jq + .78 * fontSize, gT) : gT.fillText(ad.k3.k4(ev[dw]), jp, jq + .78 * fontSize))); + }(jp, jq, fontSize, dw, gT), (jr = a8W * fontSize) < a8Y || (gT.font = g1 + jr + g2, aR.k1.k2 ? a94(dw, jr, jp, jq + .78 * fontSize, gT) : (gT.fillText(ad.k3.k4(ev[dw]), jp, jq + .78 * fontSize), settings.showPlayerDensity && gT + .fillText(utils.getDensity(dw), jp, jq + fontSize * 1.5)))); gT.imageSmoothingEnabled = !1 } function a94(dw, fontSize, jn, jo, gT) { - gT.fillText(k5[dw], jn, jo), dw < h9 && 2 !== hB[dw] || (dw = fontSize / a8T[dw], gT.fillRect(jn - .5 * dw, jo + ad.kp.t6 * fontSize, dw, Math.max(1, .1 * fontSize))) + gT.fillText(k5[dw], jn, jo), aR.k1.k2 && settings.showPlayerDensity && gT.fillText(utils.getDensity(dw), jn, jo + fontSize), dw < h9 && 2 !== hB[dw] || (dw = fontSize / a8T[dw], gT.fillRect(jn - .5 * dw, jo + ad.kp.t6 * fontSize, dw, Math + .max(1, .1 * fontSize))) } function a96(jp, jq, fontSize, a99, a9A, gT) { diff --git a/index.html b/index.html index f4c1d52..6e00b66 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@ - +