From 287f58db6223f03de9d12ab4818067508a02b9c4 Mon Sep 17 00:00:00 2001 From: peshomir <80340328+peshomir@users.noreply.github.com> Date: Sat, 24 Aug 2024 15:58:30 +0300 Subject: [PATCH] Fixes for game versions ^1.99.5.7 --- build.js | 6 +++--- patches.js | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build.js b/build.js index fc021bd..7312656 100644 --- a/build.js +++ b/build.js @@ -94,8 +94,8 @@ 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, + /=function\((\w+),(\w+),\w+\){\1===(?\w+)\.(?\w+)\?\w+\(175," "\+\w+\(34,\[(?\w+)\.(?\w+)\[\2\]\]\),1001,\2,\w+\(/g, + /\w+\.\w+\((\w+)\)\?\w+\.\w+\(\1\)\?(\w+)=(\w+)\(29,\[\2\]\):\(\w+=\w+\.\w+\(\1\),\2=\3\(30,\[\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, /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, /\w+\.font=(?\w+\.\w+\.\w+)\(1,\.39\*this\.\w+\),/g @@ -103,7 +103,7 @@ const generateRegularExpression = (/** @type {string} */ code, /** @type {boolea 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],", + "[0]=@L(80),@strs[1]=@game.@gIsSingleplayer?@L(81):@L(82),", "?(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 98a0ff6..7176933 100644 --- a/patches.js +++ b/patches.js @@ -13,8 +13,8 @@ export default ({ replace, replaceOne, replaceRawCode, dictionary, matchOne, mat replaceOne(/(\(22,"logo",8,")[^"]+"\)/g, "$1" + assets.smallLogo + "\")"); // Add FX Client version info to the game version window - replaceRawCode(`ar.oa(4,1,new s8("ℹ️ "+Translations.txt[84],gameVersion+"
"+ah.aC5+"",`, - `ar.oa(4,1,new s8("ℹ️ "+Translations.txt[84],gameVersion+"
"+ah.aC5+"" + replaceRawCode(`ar.oa(4,1,new s8(L(252),gameVersion+"
"+ah.aC5+"",`, + `ar.oa(4,1,new s8(L(252),gameVersion+"
"+ah.aC5+"" + "

" + "FX Client v" + fx_version + " " + fx_update + "
FX Client Discord server" + "
Github repository
",`); @@ -22,8 +22,8 @@ export default ({ replace, replaceOne, replaceRawCode, dictionary, matchOne, mat // TODO: test this; it might cause issues with new boat mechanics? { // Add Troop Density and Maximum Troops in side panel - const { valuesArray } = replaceRawCode(`,labels[5]=aV.nU[76],labels[6]=aV.nU[77],labels[7]=aV.nU[78],(valuesArray=new Array(labels.length))[0]=game.io?`, - `,labels[5]=aV.nU[76],labels[6]=aV.nU[77],labels[7]=aV.nU[78], + const { valuesArray } = replaceRawCode(`,labels[5]=L(86),labels[6]=L(87),labels[7]=L(88),(valuesArray=new Array(labels.length))[0]=game.io?`, + `,labels[5]=L(86),labels[6]=L(87),labels[7]=L(88), labels.push("Max Troops", "Density"), // add labels (valuesArray=new Array(labels.length))[0]=game.io?`); replaceOne(new RegExp(/(:(?\w+)<7\?\w+\.\w+\.\w+\(valuesArray\[\2\]\)):(\w+\.\w+\(valuesArray\[7\]\))}/ @@ -36,18 +36,18 @@ export default ({ replace, replaceOne, replaceRawCode, dictionary, matchOne, mat } // Increment win counter on wins - replaceRawCode(`=function(sE){o.ha(sE,2),b.h9<100?xD(0,aZ.tG(4,[a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0):xD(0,aZ.tG(12,[a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0)`, + replaceRawCode(`=function(sE){o.ha(sE,2),b.h9<100?xD(0,L(21,[a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0):xD(0,L(28,[a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0)`, `=function(sE){ if (${playerId} === sE && !${gIsSingleplayer}) wins_counter++, window.localStorage.setItem("fx_winCount", wins_counter), xD(0,"Your Win Count is now " + wins_counter,3,sE,ad.gN,ad.kl,-1,!0); - o.ha(sE,2),b.h9<100?xD(0,aZ.tG(4,[a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0):xD(0,aZ.tG(12,[a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0)`); + o.ha(sE,2),b.h9<100?xD(0,L(21,[a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0):xD(0,L(28,[a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0)`); { // Add settings button and win count // add settings button - replaceRawCode(`,new nQ("⚙️
Menu",function(){aD6(3)},aa.ks),new nQ("",function(){at.d5(12)},aa.kg,!1)]`, - `,new nQ("⚙️
Menu",function(){aD6(3)},aa.ks),new nQ("",function(){at.d5(12)},aa.kg,!1), + replaceRawCode(`,new nQ("☰
"+L(193),function(){aD6(3)},aa.ks),new nQ("",function(){at.d5(12)},aa.kg,!1)]`, + `,new nQ("☰
"+L(193),function(){aD6(3)},aa.ks),new nQ("",function(){at.d5(12)},aa.kg,!1), 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);`, @@ -136,7 +136,7 @@ canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6 { // Player list and leaderboard filter tabs // Draw player list button const uiOffset = dictionary.uiSizes + "." + dictionary.gap; - const { groups: { drawFunction, topBarHeight } } = replaceOne(/(=1;function (?\w+)\(\){[^}]+?(?\w+)\.fillRect\(0,(?\w+),\w+,1\),(?:\3\.fillRect\([^()]+\),)+\3\.font=\w+,(\w+\.\w+)\.textBaseline\(\3,1\),\5\.textAlign\(\3,1\),\3\.fillText\(\w+\.\w+\[65\],Math\.floor\()(\w+)\/2\),(Math\.floor\(\w+\+\w+\/2\)\));/g, + const { groups: { drawFunction, topBarHeight } } = replaceOne(/(=1;function (?\w+)\(\){[^}]+?(?\w+)\.fillRect\(0,(?\w+),\w+,1\),(?:\3\.fillRect\([^()]+\),)+\3\.font=\w+,(\w+\.\w+)\.textBaseline\(\3,1\),\5\.textAlign\(\3,1\),\3\.fillText\(\w+\(79\),Math\.floor\()(\w+)\/2\),(Math\.floor\(\w+\+\w+\/2\)\));/g, "$1($6 + $ - 22) / 2), $7; playerList.drawButton($, 12, 12, $ - 22);"); const buttonBoundsCheck = `utils.isPointInRectangle($, $, ${uiOffset} + 12, ${uiOffset} + 12, ${topBarHeight} - 22, ${topBarHeight} - 22)` // Handle player list button and leaderboard tabs mouseDown