Matchmaker & some improvements.

**Changes**

- Added the websocket for matchmaker into the server so you can use the matchmaker again. (more infos in the ReadMe file)
- Added some fixes into the cloudstorage to fix long waiting on nintendo switch & mobile when checking server connection.
- Added support for the F8 key to bring up the console.
- Removed a console.log in functions to clean up the log (no longer showing the season in log for no reason)
This commit is contained in:
Secret1337
2023-09-27 20:17:13 +02:00
committed by GitHub
parent 2ea81cbde5
commit f7457bc92d
7 changed files with 118 additions and 5 deletions

View File

@@ -8,4 +8,21 @@ ServerPort=80
[OnlineSubsystemMcp.Xmpp Prod] [OnlineSubsystemMcp.Xmpp Prod]
bUseSSL=false bUseSSL=false
ServerAddr="ws://127.0.0.1" ServerAddr="ws://127.0.0.1"
ServerPort=80 ServerPort=80
# Forces fortnite to use the v1 party system to support lawinserver xmpp
[OnlineSubsystemMcp]
bUsePartySystemV2=false
# Forces fortnite to use the v1 party system to support lawinserver xmpp
[OnlineSubsystemMcp.OnlinePartySystemMcpAdapter]
bUsePartySystemV2=false
# Fix for XMPP not working on some versions
[XMPP]
bEnableWebsockets=true
# Fix for long waiting at checking connections to datacenters on Switch & Mobile
[/Script/Qos.QosRegionManager]
NumTestsPerRegion=1
PingTimeout=0.1

View File

@@ -0,0 +1,3 @@
[/Script/Engine.InputSettings]
+ConsoleKeys=Tilde # Enables console using the tilde key
+ConsoleKeys=F8 # Enables console using the F8 key

View File

@@ -60,6 +60,7 @@
- Purchasable battle pass from Season 2 to Season 10 (Can change) - Purchasable battle pass from Season 2 to Season 10 (Can change)
- Discovery Tab - Discovery Tab
- Configurable backend sided in-game events - check out the Events seciton in config.ini for more details - Configurable backend sided in-game events - check out the Events seciton in config.ini for more details
- Joining gameservers using the matchmaker - check out the GameServer seciton in config.ini for more details
## How to use? ## How to use?
1) Install [NodeJS](https://nodejs.org/en/) 1) Install [NodeJS](https://nodejs.org/en/)

View File

@@ -1,6 +1,12 @@
const XMLBuilder = require("xmlbuilder"); const XMLBuilder = require("xmlbuilder");
const uuid = require("uuid"); const uuid = require("uuid");
async function sleep(ms) {
await new Promise((resolve, reject) => {
setTimeout(resolve, ms);
})
}
function GetVersionInfo(req) { function GetVersionInfo(req) {
var memory = { var memory = {
season: 0, season: 0,
@@ -236,7 +242,6 @@ function getContentPages(req) {
try { try {
const backgrounds = contentpages.dynamicbackgrounds.backgrounds.backgrounds; const backgrounds = contentpages.dynamicbackgrounds.backgrounds.backgrounds;
const season = `season${memory.season}${memory.season >= 21 ? "00" : ""}`; const season = `season${memory.season}${memory.season >= 21 ? "00" : ""}`;
console.log(season)
backgrounds[0].stage = season; backgrounds[0].stage = season;
backgrounds[1].stage = season; backgrounds[1].stage = season;
@@ -354,6 +359,7 @@ function DecodeBase64(str) {
} }
module.exports = { module.exports = {
sleep,
GetVersionInfo, GetVersionInfo,
getItemShop, getItemShop,
getTheater, getTheater,

82
structure/matchmaker.js Normal file
View File

@@ -0,0 +1,82 @@
const functions = require("./functions.js");
module.exports = async (ws) => {
// create hashes
const ticketId = functions.MakeID().replace(/-/gi, "");
const matchId = functions.MakeID().replace(/-/gi, "");
const sessionId = functions.MakeID().replace(/-/gi, "");
Connecting();
await functions.sleep(800);
Waiting();
await functions.sleep(1000);
Queued();
await functions.sleep(4000);
SessionAssignment();
await functions.sleep(2000);
Join();
function Connecting() {
ws.send(
JSON.stringify({
payload: {
state: "Connecting",
},
name: "StatusUpdate",
})
);
}
function Waiting() {
ws.send(
JSON.stringify({
payload: {
totalPlayers: 1,
connectedPlayers: 1,
state: "Waiting",
},
name: "StatusUpdate",
})
);
}
function Queued() {
ws.send(
JSON.stringify({
payload: {
ticketId: ticketId,
queuedPlayers: 0,
estimatedWaitSec: 0,
status: {},
state: "Queued",
},
name: "StatusUpdate",
})
);
}
function SessionAssignment() {
ws.send(
JSON.stringify({
payload: {
matchId: matchId,
state: "SessionAssignment",
},
name: "StatusUpdate",
})
);
}
function Join() {
ws.send(
JSON.stringify({
payload: {
matchId: matchId,
sessionId: sessionId,
joinDelaySec: 1,
},
name: "Play",
})
);
}
};

View File

@@ -15,7 +15,7 @@ express.get("/fortnite/api/game/v2/matchmakingservice/ticket/player/*", async (r
res.cookie("currentbuildUniqueId", req.query.bucketId.split(":")[0]); res.cookie("currentbuildUniqueId", req.query.bucketId.split(":")[0]);
res.json({ res.json({
"serviceUrl": "ws://lawinservermatchmaker.herokuapp.com", "serviceUrl": "ws://127.0.0.1",
"ticketType": "mms-player", "ticketType": "mms-player",
"payload": "69=", "payload": "69=",
"signature": "420=" "signature": "420="

View File

@@ -3,17 +3,21 @@ const XMLBuilder = require("xmlbuilder");
const XMLParser = require("xml-parser"); const XMLParser = require("xml-parser");
const functions = require("./../structure/functions.js"); const functions = require("./../structure/functions.js");
const matchmaker = require("./matchmaker.js");
const port = 80; const port = 80;
const wss = new WebSocket({ port: port }, () => console.log("XMPP started listening on port", port)); const wss = new WebSocket({ port: port }, () => console.log("XMPP and Matchmaker started listening on port", port));
wss.on("error", (err) => { wss.on("error", (err) => {
console.log("XMPP \x1b[31mFAILED\x1b[0m to start hosting (NOTE: This should not affect LawinServer)."); console.log("XMPP and Matchmaker \x1b[31mFAILED\x1b[0m to start hosting.");
}) })
global.Clients = []; global.Clients = [];
wss.on('connection', async (ws) => { wss.on('connection', async (ws) => {
if (ws.protocol.toLowerCase() != "xmpp") return matchmaker(ws);
var accountId = ""; var accountId = "";
var jid = ""; var jid = "";
var id = ""; var id = "";