From c906e80d789e1b7092d1b90399c39f598e6f0aca Mon Sep 17 00:00:00 2001 From: peshomir <80340328+peshomir@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:41:13 +0200 Subject: [PATCH] Update v0.6.0.1 Donation tracking is back, now showing both received and sent donations; removed settings option to hide or show donations from bots, new options within the donation viewer itself will be implemented soon --- build.js | 5 +++-- static/fx_core.js | 15 +++++++++------ static/index.html | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/build.js b/build.js index 33e557d..8284b8b 100644 --- a/build.js +++ b/build.js @@ -73,8 +73,9 @@ replaceOne(/(((\w+)\[\w+\])=\2\.replace\(\w+(\[\w+\]),\w+\4\))/g, "$1; if (setti replaceOne(/(this\.\w+=function\(\){)((\w+\.\w+)\[2\]=\3\[3\]=\3\[4\]=(?!this\.\w+\.\w+),)/g, "$1 if (settings.hideAllLinks) $3[0] = $3[1] = $; else $3[0] = $3[1] = true; $2") -// Track donations -- todo - +// Track donations +replaceOne(/(this\.\w+=function\((\w+),(\w+)\)\{)(\2===\w+&&\(\w+\.\w+\((\w+\.\w+)\[0\],\5\[1\],\3\),this\.(\w+)\[12\]\+=\5\[1\],this\.\6\[16\]\+=\5\[0\]\),\3===\w+&&\()/g, +"$1 donationsTracker.logDonation($2, $3, $5[0]); $4") // Display donations for a player when clicking on them in the leaderboard // match , 0 !== dG[x]) && fq.hB(x, 800, false, 0), diff --git a/static/fx_core.js b/static/fx_core.js index c361526..2471290 100644 --- a/static/fx_core.js +++ b/static/fx_core.js @@ -1,5 +1,5 @@ -const fx_version = '0.6'; // FX Client Version -const fx_update = 'Jan 31'; // FX Client Last Updated +const fx_version = '0.6.0.1'; // FX Client Version +const fx_update = 'Feb 1'; // FX Client Last Updated if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) { @@ -21,7 +21,7 @@ var settingsManager = new (function() { fontName: document.getElementById("settings_fontname") }; var checkboxFields = { - showBotDonations: document.getElementById("settings_donations_bots"), + //showBotDonations: document.getElementById("settings_donations_bots"), hideAllLinks: document.getElementById("settings_hidealllinks"), realisticNames: document.getElementById("settings_realisticnames"), //customMapFileBtn: document.getElementById("settings_custommapfileinput") @@ -88,7 +88,7 @@ WindowManager.add({ name: "donationHistory", element: document.querySelector("#donationhistory"), beforeOpen: function(isSingleplayer) { - document.getElementById("donationhistory_note").style.display = ((settings.showBotDonations || /*getVarByName("dt")*/ isSingleplayer) ? "none" : "block"); + document.getElementById("donationhistory_note").style.display = ((true || settings.showBotDonations || /*getVarByName("dt")*/ isSingleplayer) ? "none" : "block"); } }); document.getElementById("canvasA").addEventListener("mousedown", WindowManager.closeAll); @@ -103,7 +103,9 @@ var donationsTracker = new (function(){ // from inside of game: // ((!gE[g].startsWith("[Bot] ") || settings.showBotDonations) && donationsTracker.logDonation(g,k,x)) this.logDonation = function(senderID, receiverID, amount) { - this.donationHistory[receiverID].push([senderID,amount]); + const donationInfo = [senderID, receiverID, amount]; + this.donationHistory[receiverID].push(donationInfo); + this.donationHistory[senderID].push(donationInfo); }; this.getRecipientHistoryOf = function(playerID) { return this.donationHistory[playerID]; @@ -118,7 +120,8 @@ function displayDonationsHistory(playerID, playerNames, isSingleplayer) { var historyText = ""; history.reverse(); if (history.length > 0) history.forEach(function(historyItem, index) { - historyText += (history.length - index) + ". Received " + historyItem[1] + " resources from " + playerNames[historyItem[0]] + "
"; + if (playerID === historyItem[1]) historyText += `${(history.length - index)}. Received ${historyItem[2]} resources from ${playerNames[historyItem[0]]}
`; + else historyText += `${(history.length - index)}. Sent ${historyItem[2]} resources to ${playerNames[historyItem[1]]}
`; }); else historyText = "Nothing to display"; document.querySelector("#donationhistory p#donationhistory_text").innerHTML = historyText; diff --git a/static/index.html b/static/index.html index 500fc24..bfb8b40 100644 --- a/static/index.html +++ b/static/index.html @@ -60,10 +60,10 @@



-