diff --git a/patches/customLobby.js b/patches/customLobby.js
index 5bc5af5..2dd9c67 100644
--- a/patches/customLobby.js
+++ b/patches/customLobby.js
@@ -16,8 +16,10 @@ export default (/** @type {ModUtils} */ { modifyCode, insertCode, replaceCode, r
insertCode(`this.y___ = function() { s___.t(5, 5); };
this.a3a = function() { s___.w___(); aY.init(); }; /* here */`,
`__fx.customLobby.setJoinFunction(() => { s___.w___(); aY.init(); });`)
- replaceCode(`var aRc;if(l.dk){aRc="ws://localhost:"+(7130+a09)+"/";}else{aRc=aRX[0]+az.y.aQ9[a09]+aRX[1+l.dl];}aRW=new WebSocket(aRc)`,
- `var aRc;if(l.dk){aRc="ws://localhost:"+(7130+a09)+"/";}else{aRc=aRX[0]+az.y.aQ9[a09]+aRX[1+l.dl];}aRW=new WebSocket(__fx.customLobby.isActive() && a09 === 1 ? __fx.customLobby.getSocketURL() : aRc)`)
+ modifyCode(`var l;
+ ${insert(`if (__fx.customLobby.isActive()) l = __fx.customLobby.getSocketURL();
+ else`)} if (b.c) { l = "ws://localhost:" + (7130 + d) + "/"; }`)
+
// if the server is unreachable
insertCode(`if (socketId === 0) { q.a08(3249); return; } /* here */`,
`if (socketId === 1 && __fx.customLobby.isActive()) {
diff --git a/patches/misc.js b/patches/misc.js
index b90e80e..24fcf55 100644
--- a/patches/misc.js
+++ b/patches/misc.js
@@ -1,8 +1,14 @@
import { definePatch, insert } from "../modUtils.js"
import { styleText } from "node:util";
-export default definePatch(({ insertCode, modifyCode }) => {
+export default definePatch(({ insertCode, modifyCode, replaceCode }) => {
+ // Add FX Client version info to the game version window
+ modifyCode(`4, 1, new g(__L(), b.c + "
" + d.e.f("/changelog")
+ ${insert(` + "
" + "FX Client v" + __fx.version
+ + "
FX Client Discord server"
+ + "
Github repository"`)} /*...*/)`)
+
// Hide propaganda popup
insertCode(`/* here */
a = b.c + 60 * 1000;
@@ -14,6 +20,9 @@ export default definePatch(({ insertCode, modifyCode }) => {
return;
} ${insert(`if (!__fx.settings.hidePropagandaPopup && !__fx.customLobby.isActive())`)} a.g.h(5);`)
+ // Invalid hostname detection avoidance
+ replaceCode(`this.hostnameIsValid = a.indexOf("territorial.io") >= 0;`, `this.hostnameIsValid = true;`)
+
// for the custom lobby version
try {
modifyCode(`new a("⚔️
" + __L(), function() {
diff --git a/patches/patches.js b/patches/patches.js
index fa7eec7..83dbad0 100644
--- a/patches/patches.js
+++ b/patches/patches.js
@@ -49,12 +49,6 @@ function applyPatches(/** @type {ModUtils} */ { replace, replaceOne, replaceRawC
replaceOne(/(\(6,"territorial\.io",6,")[^"]+"\),/g, "$1" + assets.fxClientLogo + "\"),");
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(__L(),c.gameVersion+"
"+ah.aC5+"",`,
- `ar.oa(4,1,new s8(__L(),c.gameVersion+"
"+ah.aC5+""
-+ "
" + "FX Client v" + __fx.version + "
FX Client Discord server"
-+ "
Github repository",`);
-
// Add update information
replaceRawCode(`new k("🚀 New Game Update","The game was updated! Please reload the game.",!0,[`,
`new k("🚀 New Game Update","The game was updated! Please reload the game."
@@ -171,10 +165,6 @@ function applyPatches(/** @type {ModUtils} */ { replace, replaceOne, replaceRawC
`qr = (__fx.settings.detailedTeamPercentage ? (100*f0).toFixed(2) : Math.floor(100*f0+.5)) + "%"`)
replaceRawCode(",fontSize=+dz*Math.min(f0,.37);", ",fontSize=(__fx.settings.detailedTeamPercentage ? 0.75 : 1)*dz*Math.min(f0,.37);")
- // Invalid hostname detection avoidance
- replaceRawCode(`,this.hostnameIsValid=0<=window.location.hostname.toLowerCase().indexOf("territorial.io"),`,
- `,this.hostnameIsValid=true,`)
-
console.log('Removing ads...');
// Remove ads
replace('//api.adinplay.com/libs/aiptag/pub/TRT/territorial.io/tag.min.js', '');