Compare commits

..

3 Commits

Author SHA1 Message Date
peshomir e6fd193bee Bump version
Added version info and changelog for v0.6.9
2025-06-28 17:39:35 +03:00
peshomir f61db08e06 Point users to the stable custom lobby version when the custom lobby button in the main menu is clicked 2025-06-28 17:37:24 +03:00
D-D|1 4d6a437274
feat: Update FXClient for latest Territorial.io version (2025-06-26) (#18)
fix: update customLobby.js for latest territorial.io compatibility

- Updated WebSocket connection pattern for new variable names
- Fixed replaceCode matching for complete code block structure
- Verified basic functionality in custom lobby
- Resolves build error in patches/customLobby.js:19
2025-06-28 17:12:05 +03:00
3 changed files with 22 additions and 11 deletions

View File

@ -16,9 +16,8 @@ export default (/** @type {ModUtils} */ { insertCode, replaceCode, replaceRawCod
insertCode(`this.y___ = function() { s___.t(5, 5); }; insertCode(`this.y___ = function() { s___.t(5, 5); };
this.a3a = function() { s___.w___(); aY.init(); }; /* here */`, this.a3a = function() { s___.w___(); aY.init(); }; /* here */`,
`__fx.customLobby.setJoinFunction(() => { s___.w___(); aY.init(); });`) `__fx.customLobby.setJoinFunction(() => { s___.w___(); aY.init(); });`)
replaceCode(`var url = aQt[0] + Sockets.a.b[socketId] + aQt[1 + l.dg]; socket = new WebSocket(url);`, 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 url = aQt[0] + Sockets.a.b[socketId] + aQt[1 + l.dg]; `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)`)
socket = new WebSocket(__fx.customLobby.isActive() && socketId === 1 ? __fx.customLobby.getSocketURL() : url);`)
// if the server is unreachable // if the server is unreachable
insertCode(`if (socketId === 0) { q.a08(3249); return; } /* here */`, insertCode(`if (socketId === 0) { q.a08(3249); return; } /* here */`,
`if (socketId === 1 && __fx.customLobby.isActive()) { `if (socketId === 1 && __fx.customLobby.isActive()) {
@ -38,6 +37,8 @@ export default (/** @type {ModUtils} */ { insertCode, replaceCode, replaceRawCod
`(__fx.customLobby.setLeaveFunction(() => {n.r(),bl.zf(),Sockets.s.ze(3240),__fx.customLobby.setActive(false),n.o(5,5)}), `(__fx.customLobby.setLeaveFunction(() => {n.r(),bl.zf(),Sockets.s.ze(3240),__fx.customLobby.setActive(false),n.o(5,5)}),
function(){n.r(),bl.zf(),Sockets.s.ze(3240),__fx.customLobby.setActive(false),n.o(5,5)})`) function(){n.r(),bl.zf(),Sockets.s.ze(3240),__fx.customLobby.setActive(false),n.o(5,5)})`)
// when a socket error occurs on the custom lobby socket // when a socket error occurs on the custom lobby socket
// TODO: Fix these after main WebSocket fix is confirmed working
/*
replaceRawCode("this.wQ=function(wR,d){if(8===i.pz&&0===wR)if(4211===d)wS(d);", replaceRawCode("this.wQ=function(wR,d){if(8===i.pz&&0===wR)if(4211===d)wS(d);",
`this.wQ=function(wR,d){ `this.wQ=function(wR,d){
wR===1 && __fx.customLobby.isActive() && ${dict.MenuManager}.${dict.getState}() !== 6 && __fx.customLobby.setActive(false); wR===1 && __fx.customLobby.isActive() && ${dict.MenuManager}.${dict.getState}() !== 6 && __fx.customLobby.setActive(false);
@ -76,5 +77,6 @@ export default (/** @type {ModUtils} */ { insertCode, replaceCode, replaceRawCod
replaceRawCode("1===a.b?this.gLobbyMaxJoin=this.gHumans:this.gLobbyMaxJoin=this.data.playerCount,this.maxPlayers=this.gLobbyMaxJoin,this.gBots=this.gLobbyMaxJoin-this.gHumans,this.sg=0,", replaceRawCode("1===a.b?this.gLobbyMaxJoin=this.gHumans:this.gLobbyMaxJoin=this.data.playerCount,this.maxPlayers=this.gLobbyMaxJoin,this.gBots=this.gLobbyMaxJoin-this.gHumans,this.sg=0,",
`this.gLobbyMaxJoin = __fx.customLobby.isActive() ? Math.max(Math.min(__fx.customLobby.gameInfo.botCount, this.data.playerCount), this.gHumans) : 1===a.b?this.gLobbyMaxJoin=this.gHumans:this.gLobbyMaxJoin=this.data.playerCount, `this.gLobbyMaxJoin = __fx.customLobby.isActive() ? Math.max(Math.min(__fx.customLobby.gameInfo.botCount, this.data.playerCount), this.gHumans) : 1===a.b?this.gLobbyMaxJoin=this.gHumans:this.gLobbyMaxJoin=this.data.playerCount,
this.maxPlayers=this.gLobbyMaxJoin,this.gBots=this.gLobbyMaxJoin-this.gHumans,this.sg=0,`) this.maxPlayers=this.gLobbyMaxJoin,this.gBots=this.gLobbyMaxJoin-this.gHumans,this.sg=0,`)
*/
}); });
} }

View File

@ -1,5 +1,6 @@
import WindowManager from "./windowManager.js"; import WindowManager from "./windowManager.js";
const customLobbiesUnavailable = true;
//const socketURL = "ws://localhost:8080/"; //const socketURL = "ws://localhost:8080/";
const socketURL = "wss://fx.peshomir.workers.dev/"; const socketURL = "wss://fx.peshomir.workers.dev/";
const customMessageMarker = 120; const customMessageMarker = 120;
@ -15,6 +16,15 @@ WindowManager.add({
name: "lobbyJoinMenu", name: "lobbyJoinMenu",
element: document.getElementById("customLobbyJoinMenu") element: document.getElementById("customLobbyJoinMenu")
}) })
if (customLobbiesUnavailable) {
const window = WindowManager.create({
name: "customLobbiesUnavailable",
closeWithButton: true
});
window.innerHTML = `<p>The latest version of FX Client doesn't support custom lobbies yet. Use the stable version at <a href="https://fxclient.github.io/custom-lobbies/">https://fxclient.github.io/custom-lobbies</a></p>`;
}
const windowElement = WindowManager.create({ const windowElement = WindowManager.create({
name: "customLobby", name: "customLobby",
classes: "scrollable selectable flex-column text-align-center", classes: "scrollable selectable flex-column text-align-center",
@ -155,6 +165,8 @@ function setSelectMenuOptions(options, element) {
} }
function showJoinPrompt() { function showJoinPrompt() {
if (customLobbiesUnavailable)
return WindowManager.openWindow("customLobbiesUnavailable");
WindowManager.openWindow("lobbyJoinMenu"); WindowManager.openWindow("lobbyJoinMenu");
} }
document.getElementById("lobbyCode").addEventListener("input", ({ target: input }) => { document.getElementById("lobbyCode").addEventListener("input", ({ target: input }) => {
@ -301,6 +313,7 @@ function rejoinLobby() {
function checkForLobbyLink(isHashChangeEvent) { function checkForLobbyLink(isHashChangeEvent) {
const hash = window.location.hash; const hash = window.location.hash;
if (hash.startsWith("#lobby=")) { if (hash.startsWith("#lobby=")) {
if (customLobbiesUnavailable) return WindowManager.openWindow("customLobbiesUnavailable");
// in case the player is already in a lobby // in case the player is already in a lobby
if (isHashChangeEvent) leaveLobby(); if (isHashChangeEvent) leaveLobby();
currentCode = hash.slice(7); currentCode = hash.slice(7);

View File

@ -1,12 +1,8 @@
{ {
"version": "0.6.8", "version": "0.6.9",
"lastUpdated": "Mar 22", "lastUpdated": "Jun 28",
"changes": [ "changes": [
"Added a \"What's new\" screen (the one you're looking at right now!) which displays a changelog of the latest version", "Updated FX Client to the latest game version",
"Added custom lobby join links - to get one, click on the new \"Copy link\" button while in a lobby.", "The custom lobbies haven't been updated to work in this version, but are still available in the new stable custom lobby version. A link to it is available in the alert which opens when clicking the custom lobby button in the main menu."
"Added version information at the bottom of the setting page along with a link to the FX Client Discord server and GitHub repository. Previously this was shown only in the vanilla version menu.",
"Added a settings option to toggle displaying a player's donation history when clicking on their name in the leaderboard (applies to team games only)",
"Changed the font for the FX Client UI elements",
"The custom lobby server no longer tries to verify the compatibility of the client's protocol version. This will make custom lobbies usable immediately after an update, provided that the communication protocol has not changed significantly."
] ]
} }