mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-12 18:32:23 +01:00
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:
@@ -8,4 +8,21 @@ ServerPort=80
|
||||
[OnlineSubsystemMcp.Xmpp Prod]
|
||||
bUseSSL=false
|
||||
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
|
||||
3
CloudStorage/DefaultInput.ini
Normal file
3
CloudStorage/DefaultInput.ini
Normal file
@@ -0,0 +1,3 @@
|
||||
[/Script/Engine.InputSettings]
|
||||
+ConsoleKeys=Tilde # Enables console using the tilde key
|
||||
+ConsoleKeys=F8 # Enables console using the F8 key
|
||||
@@ -60,6 +60,7 @@
|
||||
- Purchasable battle pass from Season 2 to Season 10 (Can change)
|
||||
- Discovery Tab
|
||||
- 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?
|
||||
1) Install [NodeJS](https://nodejs.org/en/)
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
const XMLBuilder = require("xmlbuilder");
|
||||
const uuid = require("uuid");
|
||||
|
||||
async function sleep(ms) {
|
||||
await new Promise((resolve, reject) => {
|
||||
setTimeout(resolve, ms);
|
||||
})
|
||||
}
|
||||
|
||||
function GetVersionInfo(req) {
|
||||
var memory = {
|
||||
season: 0,
|
||||
@@ -236,7 +242,6 @@ function getContentPages(req) {
|
||||
try {
|
||||
const backgrounds = contentpages.dynamicbackgrounds.backgrounds.backgrounds;
|
||||
const season = `season${memory.season}${memory.season >= 21 ? "00" : ""}`;
|
||||
console.log(season)
|
||||
backgrounds[0].stage = season;
|
||||
backgrounds[1].stage = season;
|
||||
|
||||
@@ -354,6 +359,7 @@ function DecodeBase64(str) {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sleep,
|
||||
GetVersionInfo,
|
||||
getItemShop,
|
||||
getTheater,
|
||||
|
||||
82
structure/matchmaker.js
Normal file
82
structure/matchmaker.js
Normal 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",
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -15,7 +15,7 @@ express.get("/fortnite/api/game/v2/matchmakingservice/ticket/player/*", async (r
|
||||
res.cookie("currentbuildUniqueId", req.query.bucketId.split(":")[0]);
|
||||
|
||||
res.json({
|
||||
"serviceUrl": "ws://lawinservermatchmaker.herokuapp.com",
|
||||
"serviceUrl": "ws://127.0.0.1",
|
||||
"ticketType": "mms-player",
|
||||
"payload": "69=",
|
||||
"signature": "420="
|
||||
|
||||
@@ -3,17 +3,21 @@ const XMLBuilder = require("xmlbuilder");
|
||||
const XMLParser = require("xml-parser");
|
||||
|
||||
const functions = require("./../structure/functions.js");
|
||||
const matchmaker = require("./matchmaker.js");
|
||||
|
||||
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) => {
|
||||
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 = [];
|
||||
|
||||
wss.on('connection', async (ws) => {
|
||||
if (ws.protocol.toLowerCase() != "xmpp") return matchmaker(ws);
|
||||
|
||||
var accountId = "";
|
||||
var jid = "";
|
||||
var id = "";
|
||||
|
||||
Reference in New Issue
Block a user