diff --git a/build.js b/build.js index 0b3ccc5..8d05527 100644 --- a/build.js +++ b/build.js @@ -79,12 +79,13 @@ const generateRegularExpression = (/** @type {string} */ code, /** @type {boolea /,this\.(?\w+)=this\.\w+<7\|\|9===this\.\w+,/g, /=function\((\w+),(\w+),\w+\){\1===(?\w+)\.(?\w+)\?\w+\(175,\w+\.\w+\(18,\[(?\w+)\.(?\w+)\[\2\]\]\),1001,\2,\w+\(/g, /\w+\.\w+\((\w+)\)\?\w+\.\w+\(\1\)\?(\w+)=(\w+\.\w+)\(13,\[\2\]\):\(\w+=\w+\.\w+\(\1\),\2=\3\(14,\[\w+\.\w+\.\w+\((?\w+)\.(?\w+)\[(\w+)\],\w+\.\w+\.\w+\(0,10\),150\),(\w+\.\w+\.\w+\()\4\.(?\w+)\[\6\]\),\7\4\.(?\w+)\[\6\]\),\2\]\),\w+=!0\):\2=/g, - /,this\.(?\w+)=this\.(?\w+),this\.(?\w+)&&\(this\.\1=\w+\.\w+\(\)\),this\.\w+=this\.\1-this\.\w+,this\.\w+=0,/g, /function \w+\(\)\{if\(2===(?\w+)\.(?\w+)\)return 1;\w+\.\w+\(\),\1\.\2=2,\1\.\w+=\1.\w+\}/g, - /(function \w+\((\w+),(?\w+),(?\w+),(?\w+),(?\w+)\){)(\6\.fillText\((?\w+)\.(?\w+)\[\2\],\4,\5\)),(\2<(?\w+)\.(?\w+)&&2!==\8\.(?\w+)\[[^}]+)}/g + /(function \w+\((\w+),(?\w+),(?\w+),(?\w+),(?\w+)\){)(\6\.fillText\((?\w+)\.(?\w+)\[\2\],\4,\5\)),(\2<(?\w+)\.(?\w+)&&2!==\8\.(?\w+)\[[^}]+)}/g, + /\w+\.font=(?\w+\.\w+\.\w+)\(1,\.39\*this\.\w+\),/g ].forEach(matchDictionaryExpression); const rawCodeSegments = [ + ",this.@gIsSingleplayer?this.@gLobbyMaxJoin=@SingleplayerMenu.@getSingleplayerPlayerCount():this.gLobbyMaxJoin=this.@gMaxPlayers,this.@gBots=this.gLobbyMaxJoin-this.@gHumans,this.sg=0,", "[0]=@Translations.@txt[70],@strs[1]=@game.@gIsSingleplayer?@Translations.txt[71]:@Translations.txt[72],", "?(this.gB=Math.floor(.0536*aK.fw),g5=aK.g5-4*@uiSizes.@gap-this.gB):", `for(a0L=new Array(@game.@gMaxPlayers),a0A.font=a07,@i=game.gMaxPlayers-1;0<=i;i--)a0L[i]=i+1+".",@playerData.@playerNames[i]=aY.qW.tm(playerData.@rawPlayerNames[i],a07,a0W),a0K[i]=Math.floor(a0A.measureText(playerData.playerNames[i]).width);`, diff --git a/patches.js b/patches.js index 8352bec..7f1ca12 100644 --- a/patches.js +++ b/patches.js @@ -44,7 +44,28 @@ export default ({ replace, replaceOne, replaceRawCode, dictionary, matchOne, mat { // Add settings button and win count - // render gear icon and win count + // add settings button + replaceRawCode(`,new nQ("⚙️
Menu",function(){aD6(3)},aa.ks)]`, + `,new nQ("⚙️
Menu",function(){aD6(3)},aa.ks), + new nQ("FX Client settings", function() { WindowManager.openWindow("settings"); }, "rgba(0, 0, 20, 0.5")]`) + // set settings button position + replaceRawCode(`aZ.g5.vO(aD3[3].button,x+a0S+gap,a3X+h+gap,a0S,h);`, + `aZ.g5.vO(aD3[3].button,x+a0S+gap,a3X+h+gap,a0S,h); aZ.g5.vO(aD3[4].button, x, a3X + h * 2 + gap * 2, a0S * 2 + gap, h / 3);`); + // render win count + replaceRawCode(`if(y.a4l(),r.gI(),m.gI(),aw.gI(),ay.gI(),a0.g8()){ctx.imageSmoothingEnabled=!1;var iQ=a0.a4o("territorial.io"),kL=aD4.gA/iQ.width;`, + `if(y.a4l(),r.gI(),m.gI(),aw.gI(),ay.gI(),a0.g8()){ + if (settings.displayWinCounter) { + const size = Math.floor(aD4.gA * 0.03); + ctx.font = ${dict.fontGeneratorFunction}(1, size); + ctx.fillStyle = "#ffffff"; + const text = "Win count: " + wins_counter; + const textLength = ctx.measureText(text).width; + ctx.textAlign = "left"; + ctx.textBaseline = "middle"; + ctx.fillText(text, ctx.canvas.width - textLength - size / 2, size); + }; + ctx.imageSmoothingEnabled=!1;var iQ=a0.a4o("territorial.io"),kL=aD4.gA/iQ.width;`) + /*// render gear icon and win count replaceRawCode(`,fy=aV.nU[80],fontSize=.65*height,canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6)",canvas.fillRect(x,y,width,height),`, `,fy=aV.nU[80],fontSize=.65*height, canvas.imageSmoothingEnabled = true, @@ -61,7 +82,7 @@ canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6 replaceRawCode(`(q6=Math.floor((b7.cv.fv()?.145:.09)*aK.fw),gap=Math.floor(.065*(b7.cv.fv()?.53:.36)*aK.fw),gap=aK.g5-q6-gap,jd=b0.gap,q6=Math.floor(.35*q6),gap<=mouseX&&mouseY= gap - q6 / 0.7 && mouseY < jd + q6 && WindowManager.openWindow("settings")) -)`); +)`);*/ } { // Keybinds @@ -92,8 +113,10 @@ canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6 // Make the main canvas context have an alpha channel if a custom background is being used replaceOne(/(document\.getElementById\("canvasA"\),\(\w+=\w+\.getContext\("2d",){alpha:!1}/g, "$1 {alpha: makeMainMenuTransparent}") // Clear canvas background if a custom background is being used - replaceOne(/(this\.\w+=function\(\){var (\w+),(\w+);)(\w+\.\w+\?\([^()]+setTransform\(\3=\2<\3\?\3:\2,0,0,\3,(?:Math\.floor\(\([^)]+\)\/2\)[,)]){2},(?:[^)]+\),){2}[^)]+\):(?\w+)\.fillStyle=\w+\.\w+,\5\.fillRect\((?0,0,\w+\.\w+,\w+\.\w+)\)}})/g, - '$1 if (makeMainMenuTransparent) $.clearRect($); else $4') + replaceRawCode(`,this.qk=function(){var a4n,a4m;aq.pd?(a4m=aL.gA/aq.eE,a4n=aL.gF/aq.eF,canvas.setTransform(a4m=a4n