From 3662499a4f0d5180c1f36322096ad9cb1c572b78 Mon Sep 17 00:00:00 2001 From: peshomir <80340328+peshomir@users.noreply.github.com> Date: Fri, 12 Jul 2024 20:15:19 +0300 Subject: [PATCH] Update v0.6.5.1 - Highlight clan spawnpoints --- patches.js | 17 +++++++++++++++++ src/fx_core.js | 31 ++++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/patches.js b/patches.js index 2b051ae..ea3cf50 100644 --- a/patches.js +++ b/patches.js @@ -277,6 +277,23 @@ canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6 `aK.nH = (window.devicePixelRatio || 1) * aEr, hoveringTooltip.canvasPixelScale = aK.nH,`) } + { // Highlight clan spawnpoints + // when rendered on game start + replaceRawCode("var x;0!==playerData.eg[i]&&0!==playerData.playerTerritories[i]&&(x=playerData.nu[i]+playerData.nw[i]+1-gv-2>>1,gv=playerData.nv[i]+playerData.nx[i]+1-gv-2>>1,ctx.drawImage(km[game.gIsTeamGame?lV.i6[i]:i>1,y=playerData.nv[i]+playerData.nx[i]+1-gv-2>>1, + highlight ? ctx.drawImage(km[game.gIsTeamGame?lV.i6[i]:iay.ak)||bK>ay.al||hQ<-es||bK<-es||(bI.setTransform(cz,0,0,cz,hQ,bK),", + `function(a6,es,bK,hP,hQ,hR,ov){ + var highlight = settings.highlightClanSpawns && clanFilter.inOwnClan[a6]; + if (highlight) es *= 2; + 0===dV.eg[a6]||0===dV.ev[a6]||(hQ=ay.ak*((dV.nu[a6]+dV.nw[a6]+1)/2-bK)/(hQ-bK)-.5*es,bK=ay.al*((dV.nv[a6]+dV.nx[a6]+1)/2-hP)/(hR-hP)-.5*es,hQ>ay.ak)||bK>ay.al||hQ<-es||bK<-es||(bI.setTransform(highlight?cz*2:cz,0,0,highlight?cz*2:cz,hQ,bK),` + ) + } + // Invalid hostname detection avoidance replaceRawCode(`,hostnameIsValid=0<=window.location.hostname.toLowerCase().indexOf("territorial.io"),`, `,hostnameIsValid=0<=window.location.hostname.toLowerCase().indexOf("territorial.io") || Math.random() >= 0.8,`) diff --git a/src/fx_core.js b/src/fx_core.js index 69fac96..b3c8cf4 100644 --- a/src/fx_core.js +++ b/src/fx_core.js @@ -1,5 +1,5 @@ -const fx_version = '0.6.5'; // FX Client Version -const fx_update = 'Jul 5'; // FX Client Last Updated +const fx_version = '0.6.5.1'; // FX Client Version +const fx_update = 'Jul 12'; // FX Client Last Updated if (localStorage.getItem("fx_winCount") == undefined || localStorage.getItem("fx_winCount") == null) { var wins_counter = 0; @@ -132,6 +132,7 @@ var settings = { "showPlayerDensity": true, "coloredDensity": true, "densityDisplayStyle": "percentage", + "highlightClanSpawns": false, //"customMapFileBtn": true "customBackgroundUrl": "", "attackPercentageKeybinds": [], @@ -140,10 +141,9 @@ const discontinuedSettings = [ "hideAllLinks", "fontName" ]; let makeMainMenuTransparent = false; var settingsManager = new (function() { const settingsStructure = [ - //{ for: "fontName", type: "textInput", label: "Font name:", placeholder: "Enter font name", tooltip: "Name of the font to be used for rendering. For example: Arial, Georgia, sans-serif, serif, Comic Sans MS, ..."}, - { type: "button", text: "Reset Wins Counter", action: removeWins }, { for: "displayWinCounter", type: "checkbox", label: "Display win counter", - note: "The win counter tracks multiplayer solo wins (not in team games)" }, + note: "The win counter tracks multiplayer solo wins (not in team games)" }, + { type: "button", text: "Reset win counter", action: removeWins }, { for: "useFullscreenMode", type: "checkbox", label: "Use fullscreen mode", note: "Note: fullscreen mode will trigger after you click anywhere on the page due to browser policy restrictions." }, { for: "hoveringTooltip", type: "checkbox", label: "Hovering tooltip", @@ -156,6 +156,8 @@ var settingsManager = new (function() { { value: "percentage", label: "Percentage" }, { value: "absoluteQuotient", label: "Value from 0 to 150 (BetterTT style)" } ]}, + { for: "highlightClanSpawns", type: "checkbox", label: "Highlight clan spawnpoints", + note: "Increases the spawnpoint glow size for members of your clan" }, { for: "customBackgroundUrl", type: "textInput", label: "Custom main menu background:", placeholder: "Enter an image URL here", tooltip: "A custom image to be shown as the main menu background instead of the currently selected map." }, KeybindsInput ]; @@ -463,9 +465,10 @@ const leaderboardFilter = new (function() { }; this.filterByOwnClan = () => { this.playersToInclude = []; - const ownClan = this.parseClanFromPlayerName(getVar("rawPlayerNames")[getVar("playerId")]); + const playerId = getVar("playerId"); + const ownClan = this.parseClanFromPlayerName(getVar("rawPlayerNames")[playerId]); getVar("rawPlayerNames").forEach((name, id) => { - if (this.parseClanFromPlayerName(name) === ownClan) this.playersToInclude.push(id); + if (id === playerId || this.parseClanFromPlayerName(name) === ownClan) this.playersToInclude.push(id); }); this.enabled = true; this.scrollToTop(); @@ -474,6 +477,20 @@ const leaderboardFilter = new (function() { this.reset = () => { this.enabled = false; this.selectedTab = 0; + clanFilter.refresh(); + } +}); + +const clanFilter = new (function() { + this.inOwnClan = new Array(512); + this.inOwnClan.fill(false); + this.refresh = () => { + const gHumans = getVar("gHumans"); + const ownClan = leaderboardFilter.parseClanFromPlayerName(getVar("rawPlayerNames")[getVar("playerId")]); + if (ownClan === null) this.inOwnClan.fill(false); + else getVar("rawPlayerNames").forEach((name, id) => { + this.inOwnClan[id] = id < gHumans && leaderboardFilter.parseClanFromPlayerName(name) === ownClan; + }); } });