mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-13 10:52:23 +01:00
Merge pull request #115 from secret-pommes/main
Matchmaker & some improvements.
This commit is contained in:
@@ -9,3 +9,20 @@ ServerPort=80
|
|||||||
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
|
||||||
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
|
||||||
@@ -66,6 +66,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 host/use LawinServer
|
## How to host/use LawinServer
|
||||||
1) Install [NodeJS](https://nodejs.org/en/)
|
1) Install [NodeJS](https://nodejs.org/en/)
|
||||||
|
|||||||
@@ -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
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.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="
|
||||||
|
|||||||
@@ -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 = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user