From a1356be9d1144290152068ddc6bd7f524221c360 Mon Sep 17 00:00:00 2001 From: peshomir Date: Wed, 22 May 2024 18:49:00 +0000 Subject: [PATCH] deploy: 3537ffc9ad4574e3e1def23cdee3401bf545bfcf --- fx_core.js | 29 +++++++++++------------------ game.js | 6 +++--- index.html | 8 ++++---- 3 files changed, 18 insertions(+), 25 deletions(-) diff --git a/fx_core.js b/fx_core.js index 10b354b..2d385e4 100644 --- a/fx_core.js +++ b/fx_core.js @@ -1,6 +1,6 @@ -const dictionary = {"gIsTeamGame":"hM","playerId":"eU","playerNames":"jm","playerBalances":"eV","playerTerritories":"ez","gHumans":"h1","playerStates":"h3","gLobbyMaxJoin":"px","gIsSingleplayer":"im","gameState":"rS","uiSizes":"b0","gap":"gap"}; -const fx_version = '0.6.4.1'; // FX Client Version -const fx_update = 'May 20'; // FX Client Last Updated +const dictionary = {"gIsTeamGame":"hM","playerId":"eU","playerNames":"jm","playerBalances":"eV","playerTerritories":"ez","gHumans":"h1","playerStates":"h3","gLobbyMaxJoin":"px","gIsSingleplayer":"im","gameState":"rS","uiSizes":"b0","gap":"gap","gMaxPlayers":"ed","i":"eD","rawPlayerNames":"a0X"}; +const fx_version = '0.6.4.2'; // FX Client Version +const fx_update = 'May 22'; // FX Client Last Updated if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) { var wins_counter = 0; @@ -343,14 +343,6 @@ const playerList = new (function () { } }); -/** @param {string} name */ -function parseClanFromPlayerName(name) { - const startIndex = name.indexOf("["); - // this is probably how the algorithm works, since a player with - // the name "][a]" will count as not being in a clan in the base game - return startIndex === -1 ? "" : name.slice(startIndex + 1, name.indexOf("]")).toUpperCase(); -} - const leaderboardFilter = new (function() { this.playersToInclude = [0,1,8,20,24,30,32,42,50,69,200,400,500,510,511]; // for testing //this.playersToInclude = []; @@ -363,6 +355,7 @@ const leaderboardFilter = new (function() { this.hoveringOverTabs = false; this.scrollToTop = () => {}; this.repaintLeaderboard = () => {}; + this.parseClanFromPlayerName = () => { console.warn("parse function not set"); }; this.selectedTab = 0; this.tabHovering = -1; @@ -418,9 +411,9 @@ const leaderboardFilter = new (function() { }; this.filterByOwnClan = () => { this.playersToInclude = []; - const ownClan = parseClanFromPlayerName(getVar("playerNames")[getVar("playerId")]); - getVar("playerNames").forEach((name, id) => { - if (parseClanFromPlayerName(name) === ownClan) this.playersToInclude.push(id); + const ownClan = this.parseClanFromPlayerName(getVar("rawPlayerNames")[getVar("playerId")]); + getVar("rawPlayerNames").forEach((name, id) => { + if (this.parseClanFromPlayerName(name) === ownClan) this.playersToInclude.push(id); }); this.enabled = true; this.scrollToTop(); @@ -463,18 +456,18 @@ var donationsTracker = new (function(){ } }; function generateTableRowItem(historyItem, index, playerID, isNew) { - const playerNames = getVar("playerNames"); + const rawPlayerNames = getVar("rawPlayerNames"); const row = document.createElement("tr"); if (isNew) row.setAttribute("class", "new"); let content = `${index}. `; if (playerID === historyItem[1]) - content += `Received ${historyItem[2]} resources from ${escapeHtml(playerNames[historyItem[0]])}`; - else content += `Sent ${historyItem[2]} resources to ${escapeHtml(playerNames[historyItem[1]])}`; + content += `Received ${historyItem[2]} resources from ${escapeHtml(rawPlayerNames[historyItem[0]])}`; + else content += `Sent ${historyItem[2]} resources to ${escapeHtml(rawPlayerNames[historyItem[1]])}`; content += ""; row.innerHTML = content; return row; } - this.displayHistory = function displayDonationsHistory(playerID, playerNames = getVar("playerNames"), isSingleplayer = getVar("gIsSingleplayer")) { + this.displayHistory = function displayDonationsHistory(playerID, playerNames = getVar("rawPlayerNames"), isSingleplayer = getVar("gIsSingleplayer")) { var history = donationsTracker.getHistoryOf(playerID); console.log("History for " + playerNames[playerID] + ":"); console.log(history); diff --git a/game.js b/game.js index ec4d7a9..4e8613a 100644 --- a/game.js +++ b/game.js @@ -1873,7 +1873,7 @@ function tW() { }, this.uI = function(username) { var uK, uJ = username.indexOf("["); return !(uJ < 0) && 1 < (uK = username.indexOf("]")) - uJ && uK - uJ <= 8 ? username.substring(uJ + 1, uK).toUpperCase().trim() : null - } + }, leaderboardFilter.parseClanFromPlayerName = this.uI; } function uL() { @@ -3259,7 +3259,7 @@ function be() { }, leaderboardFilter.scrollToTop = function() { position = 0; }, this.fQ = function(fI, fJ) { - return !!vU(fI, fJ) && ((utils.isPointInRectangle(fI, fJ, b0.gap + 12, b0.gap + 12, a0F - 22, a0F - 22) && playerList.display(jm), true) && + return !!vU(fI, fJ) && ((utils.isPointInRectangle(fI, fJ, b0.gap + 12, b0.gap + 12, a0F - 22, a0F - 22) && playerList.display(a0X), true) && !(fJ - b0.gap > leaderboardFilter.verticalClickThreshold && leaderboardFilter.handleMouseDown(fI - b0.gap)) && (a0Q = b3.dY, a0R = !0, a0S = a0T = a0q(fJ), ag.tQ() && (fI = yr(-1, a0T, a08), a0P !== (fI = fI === a08 ? -1 : fI)) && (a0P = fI, a0Y(), b3.d1 = !0)), !0) }, leaderboardFilter.repaintLeaderboard = function() { @@ -3284,7 +3284,7 @@ function be() { var isEmptySpace = false; return ag.tQ() && -1 !== a0P && (a0P = -1, a0Y(), b3.d1 = !0), b3.dY - a0Q < 350 && a0T === a0p && -1 !== (a0p = (a0p = yr(-1, a0p, a08)) !== a08 && vU(fI, fJ) ? a0p : -1) && (fI = (leaderboardFilter.enabled ? jG[leaderboardFilter .filteredLeaderboard[a0p + position] ?? (isEmptySpace = true, a03[eU])] : jG[a0p + position]), a0p === a08 - 1 && (leaderboardFilter.enabled ? this.playerPos : a03[eU]) >= - position + a08 - 1 && (fI = eU), !isEmptySpace && hM && donationsTracker.displayHistory(fI, jm, im), 0 !== h2[fI] && !isEmptySpace) && f.k7(fI, 800, !1, 0), !0 + position + a08 - 1 && (fI = eU), !isEmptySpace && hM && donationsTracker.displayHistory(fI, a0X, im), 0 !== h2[fI] && !isEmptySpace) && f.k7(fI, 800, !1, 0), !0 }, this.sn = function(fI, fJ, deltaY) { var a0r; return !(a0R || k9 || (a0r = Math.max(Math.floor(Math.abs(deltaY) / 40), 1), !vU(fI, fJ)) || (fI = (fI = yr(-1, a0q(fJ), a08)) === a08 || ag.tQ() ? -1 : fI, 0 < deltaY ? position < ed - a08 && (position += Math.min(ed - a08 - position, diff --git a/index.html b/index.html index 6f04c96..10c19e4 100644 --- a/index.html +++ b/index.html @@ -34,7 +34,7 @@ - +