Mirror Gitea instance
This commit is contained in:
parent
9fd0209063
commit
f264e40eb7
15 changed files with 1921 additions and 90 deletions
|
@ -1,6 +1,3 @@
|
||||||
### This repo has been moved to a personal Gitea instance and can be found here: [Binato](https://git.eusv.ml/holly/Binato)
|
|
||||||
This repo will stay up as a irregularly updated mirror
|
|
||||||
|
|
||||||
# Binato [![CodeFactor](https://www.codefactor.io/repository/github/tgpethan/binato/badge/master)](https://www.codefactor.io/repository/github/tgpethan/binato/overview/master)
|
# Binato [![CodeFactor](https://www.codefactor.io/repository/github/tgpethan/binato/badge/master)](https://www.codefactor.io/repository/github/tgpethan/binato/overview/master)
|
||||||
An implementation of osu!bancho in Javascript
|
An implementation of osu!bancho in Javascript
|
||||||
|
|
||||||
|
|
2
osu!.sql
2
osu!.sql
|
@ -112,7 +112,7 @@ ALTER TABLE `web_titles`
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE `users_info`
|
ALTER TABLE `users_info`
|
||||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
|
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
||||||
ALTER TABLE `users_modes_info`
|
ALTER TABLE `users_modes_info`
|
||||||
MODIFY `n` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=0;
|
MODIFY `n` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=0;
|
||||||
|
|
||||||
|
|
1831
package-lock.json
generated
Normal file
1831
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
34
package.json
34
package.json
|
@ -1,20 +1,18 @@
|
||||||
{
|
{
|
||||||
"name": "binato",
|
"name": "binato",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {},
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"keywords": [],
|
||||||
},
|
"author": "",
|
||||||
"keywords": [],
|
"license": "MIT",
|
||||||
"author": "",
|
"dependencies": {
|
||||||
"license": "MIT",
|
"chalk": "^4.1.0",
|
||||||
"dependencies": {
|
"express": "^4.17.1",
|
||||||
"chalk": "^4.1.0",
|
"mysql": "^2.18.1",
|
||||||
"express": "^4.17.1",
|
"osu-packet": "^4.1.2",
|
||||||
"mysql": "^2.18.1",
|
"request": "^2.88.2",
|
||||||
"osu-packet": "^4.1.2",
|
"uuid": "^8.3.2"
|
||||||
"request": "^2.88.2",
|
}
|
||||||
"uuid": "^8.3.2"
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
const osu = require("osu-packet"),
|
const osu = require("osu-packet"),
|
||||||
maths = require("./util/Maths.js"),
|
maths = require("./util/Maths.js"),
|
||||||
OsuBattleRoyale = require("./MultiplayerExtras/OsuBattleRoyale.js");
|
OsuBattleRoyale = require("./MultiplayerExtras/OsuBattleRoyale.js");
|
||||||
//Multiplayer = require("./Multiplayer.js");
|
|
||||||
|
|
||||||
module.exports = function(User, Message, Stream, IsCalledFromMultiplayer = false) {
|
module.exports = function(User, Message, Stream, IsCalledFromMultiplayer = false) {
|
||||||
if (Message[0] != "!") return;
|
if (Message[0] != "!") return;
|
||||||
|
@ -85,18 +84,18 @@ module.exports = function(User, Message, Stream, IsCalledFromMultiplayer = false
|
||||||
if (countdown != 0 && countdown > 0) countdown--;
|
if (countdown != 0 && countdown > 0) countdown--;
|
||||||
if (countdown <= 10 && countdown > 0) {
|
if (countdown <= 10 && countdown > 0) {
|
||||||
local_osuPacketWriter.SendMessage({
|
local_osuPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "Starting in " + countdown,
|
message: "Starting in " + countdown,
|
||||||
target: "#multiplayer",
|
target: "#multiplayer",
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
global.StreamsHandler.sendToStream(Stream, local_osuPacketWriter.toBuffer, null);
|
global.StreamsHandler.sendToStream(Stream, local_osuPacketWriter.toBuffer, null);
|
||||||
} else if (countdown == 0) {
|
} else if (countdown == 0) {
|
||||||
local_osuPacketWriter.SendMessage({
|
local_osuPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "Good luck, have fun!",
|
message: "Good luck, have fun!",
|
||||||
target: "#multiplayer",
|
target: "#multiplayer",
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
global.StreamsHandler.sendToStream(Stream, local_osuPacketWriter.toBuffer, null);
|
global.StreamsHandler.sendToStream(Stream, local_osuPacketWriter.toBuffer, null);
|
||||||
User.currentMatch.matchStartCountdownActive = false;
|
User.currentMatch.matchStartCountdownActive = false;
|
||||||
|
@ -120,10 +119,10 @@ module.exports = function(User, Message, Stream, IsCalledFromMultiplayer = false
|
||||||
if (User.currentMatch.multiplayerExtras.name == "osu! Battle Royale") {
|
if (User.currentMatch.multiplayerExtras.name == "osu! Battle Royale") {
|
||||||
commandBanchoPacketWriter = new osu.Bancho.Writer;
|
commandBanchoPacketWriter = new osu.Bancho.Writer;
|
||||||
commandBanchoPacketWriter.SendMessage({
|
commandBanchoPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "osu! Battle Royale has been disabled!",
|
message: "osu! Battle Royale has been disabled!",
|
||||||
target: "#multiplayer",
|
target: "#multiplayer",
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
User.currentMatch.multiplayerExtras = null;
|
User.currentMatch.multiplayerExtras = null;
|
||||||
global.StreamsHandler.sendToStream(Stream, commandBanchoPacketWriter.toBuffer, null);
|
global.StreamsHandler.sendToStream(Stream, commandBanchoPacketWriter.toBuffer, null);
|
||||||
|
@ -143,17 +142,17 @@ module.exports = function(User, Message, Stream, IsCalledFromMultiplayer = false
|
||||||
if (responseMessage != "") {
|
if (responseMessage != "") {
|
||||||
if (Stream.includes("#")) {
|
if (Stream.includes("#")) {
|
||||||
osuPacketWriter.SendMessage({
|
osuPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: responseMessage,
|
message: responseMessage,
|
||||||
target: Stream,
|
target: Stream,
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
osuPacketWriter.SendMessage({
|
osuPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: responseMessage,
|
message: responseMessage,
|
||||||
target: "#multiplayer",
|
target: "#multiplayer",
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,16 +163,16 @@ function enableOBR(User, Stream, commandBanchoPacketWriter) {
|
||||||
User.currentMatch.multiplayerExtras = new OsuBattleRoyale(User.currentMatch);
|
User.currentMatch.multiplayerExtras = new OsuBattleRoyale(User.currentMatch);
|
||||||
commandBanchoPacketWriter = new osu.Bancho.Writer;
|
commandBanchoPacketWriter = new osu.Bancho.Writer;
|
||||||
commandBanchoPacketWriter.SendMessage({
|
commandBanchoPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "osu! Battle Royale has been enabled!",
|
message: "osu! Battle Royale has been enabled!",
|
||||||
target: "#multiplayer",
|
target: "#multiplayer",
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
commandBanchoPacketWriter.SendMessage({
|
commandBanchoPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "New Multiplayer Rules Added:\n - Players that are in a failed state by the end of the map get eliminated\n - The player(s) with the lowest score get eliminated",
|
message: "New Multiplayer Rules Added:\n - Players that are in a failed state by the end of the map get eliminated\n - The player(s) with the lowest score get eliminated",
|
||||||
target: "#multiplayer",
|
target: "#multiplayer",
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
global.StreamsHandler.sendToStream(Stream, commandBanchoPacketWriter.toBuffer, null);
|
global.StreamsHandler.sendToStream(Stream, commandBanchoPacketWriter.toBuffer, null);
|
||||||
}
|
}
|
|
@ -46,10 +46,10 @@ module.exports = class {
|
||||||
// Inform the kicked user's client that they were kicked
|
// Inform the kicked user's client that they were kicked
|
||||||
osuPacketWriter.MatchUpdate(this.MultiplayerMatch.createOsuMatchJSON());
|
osuPacketWriter.MatchUpdate(this.MultiplayerMatch.createOsuMatchJSON());
|
||||||
osuPacketWriter.SendMessage({
|
osuPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "You were eliminated from the match!",
|
message: "You were eliminated from the match!",
|
||||||
target: global.users[0].username,
|
target: global.users["bot"].username,
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
|
|
||||||
kickedPlayer.addActionToQueue(osuPacketWriter.toBuffer);
|
kickedPlayer.addActionToQueue(osuPacketWriter.toBuffer);
|
||||||
|
@ -57,10 +57,10 @@ module.exports = class {
|
||||||
osuPacketWriter = new osu.Bancho.Writer;
|
osuPacketWriter = new osu.Bancho.Writer;
|
||||||
|
|
||||||
osuPacketWriter.SendMessage({
|
osuPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: `${kickedPlayer.username} was eliminated from the match!`,
|
message: `${kickedPlayer.username} was eliminated from the match!`,
|
||||||
target: "#multiplayer",
|
target: "#multiplayer",
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
|
|
||||||
global.StreamsHandler.sendToStream(this.MultiplayerMatch.matchChatStreamName, osuPacketWriter.toBuffer, null);
|
global.StreamsHandler.sendToStream(this.MultiplayerMatch.matchChatStreamName, osuPacketWriter.toBuffer, null);
|
||||||
|
@ -94,10 +94,10 @@ module.exports = class {
|
||||||
case 0:
|
case 0:
|
||||||
remainingWriterContainer = new osu.Bancho.Writer;
|
remainingWriterContainer = new osu.Bancho.Writer;
|
||||||
remainingWriterContainer.SendMessage({
|
remainingWriterContainer.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "Everyone was eliminated from the match! Nobody wins.",
|
message: "Everyone was eliminated from the match! Nobody wins.",
|
||||||
target: global.users[0].username,
|
target: global.users["bot"].username,
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
for (i = 0; i < playerScores.length; i++) {
|
for (i = 0; i < playerScores.length; i++) {
|
||||||
playerClassContainer = getUserById(playerScores[i].playerId);
|
playerClassContainer = getUserById(playerScores[i].playerId);
|
||||||
|
@ -108,10 +108,10 @@ module.exports = class {
|
||||||
case 1:
|
case 1:
|
||||||
remainingWriterContainer = new osu.Bancho.Writer;
|
remainingWriterContainer = new osu.Bancho.Writer;
|
||||||
remainingWriterContainer.SendMessage({
|
remainingWriterContainer.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "You are the last one remaining, you win!",
|
message: "You are the last one remaining, you win!",
|
||||||
target: global.users[0].username,
|
target: global.users["bot"].username,
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
playerClassContainer.addActionToQueue(remainingWriterContainer.toBuffer);
|
playerClassContainer.addActionToQueue(remainingWriterContainer.toBuffer);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11,21 +11,15 @@ module.exports = function(CurrentUser) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the index that the user's class is at and remove the object
|
// Remove user from user list
|
||||||
for (let i = 0; i < global.users.length; i++) {
|
global.removeUser(CurrentUser);
|
||||||
if (CurrentUser.uuid == global.users[i].uuid) {
|
|
||||||
// Remove that user from the list of users
|
|
||||||
global.users.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const osuPacketWriter = new osu.Bancho.Writer;
|
const osuPacketWriter = new osu.Bancho.Writer;
|
||||||
osuPacketWriter.SendMessage({
|
osuPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: `User ${CurrentUser.username} has logged out.`,
|
message: `User ${CurrentUser.username} has logged out.`,
|
||||||
target: "#userlog",
|
target: "#userlog",
|
||||||
senderId: 3
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
global.StreamsHandler.sendToStream("#userlog", osuPacketWriter.toBuffer);
|
global.StreamsHandler.sendToStream("#userlog", osuPacketWriter.toBuffer);
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ module.exports = function(CurrentUser, CurrentPacket) {
|
||||||
} else {
|
} else {
|
||||||
const osuPacketWriter = new osu.Bancho.Writer;
|
const osuPacketWriter = new osu.Bancho.Writer;
|
||||||
osuPacketWriter.SendMessage({
|
osuPacketWriter.SendMessage({
|
||||||
sendingClient: global.users[0].username,
|
sendingClient: global.users["bot"].username,
|
||||||
message: "The channel you are currently trying to send to is locked, please check back later!",
|
message: "The channel you are currently trying to send to is locked, please check back later!",
|
||||||
target: CurrentPacket.data.target,
|
target: CurrentPacket.data.target,
|
||||||
senderId: global.users[0].id
|
senderId: global.users["bot"].id
|
||||||
});
|
});
|
||||||
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
CurrentUser.addActionToQueue(osuPacketWriter.toBuffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ module.exports = function(CurrentUser, MatchID) {
|
||||||
if (match != null) {
|
if (match != null) {
|
||||||
|
|
||||||
match.isTourneyMatch = true;
|
match.isTourneyMatch = true;
|
||||||
for (let i = 0; i < global.users.length; i++) {
|
for (let i = 0; i < global.userKeys.length; i++) {
|
||||||
if (global.users[i].id == CurrentUser.id) {
|
if (global.users[global.userKeys[i]].id == CurrentUser.id) {
|
||||||
match.tourneyClientUsers.push(global.users[i]);
|
match.tourneyClientUsers.push(global.users[global.userKeys[i]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ module.exports = function(currentUser, sendImmidiate = true) {
|
||||||
|
|
||||||
let userIds = [];
|
let userIds = [];
|
||||||
|
|
||||||
for (let i = 0; i < global.users.length; i++) {
|
for (let i = 0; i < global.userKeys.length; i++) {
|
||||||
userIds.push(global.users[i].id);
|
userIds.push(global.users[global.userKeys[i]].id);
|
||||||
}
|
}
|
||||||
|
|
||||||
osuPacketWriter.UserPresenceBundle(userIds);
|
osuPacketWriter.UserPresenceBundle(userIds);
|
||||||
|
|
|
@ -54,17 +54,17 @@ module.exports = async function(req, res, loginInfo) {
|
||||||
// Make sure user is not already connected, kick off if so.
|
// Make sure user is not already connected, kick off if so.
|
||||||
const checkForPreexistingUser = getUserByUsername(loginInfo.username);
|
const checkForPreexistingUser = getUserByUsername(loginInfo.username);
|
||||||
if (checkForPreexistingUser != null && !isTourneyClient) {
|
if (checkForPreexistingUser != null && !isTourneyClient) {
|
||||||
for (let i = 0; i < global.users.length; i++) {
|
for (let i = 0; i < global.userKeys.length; i++) {
|
||||||
const user = global.users[i];
|
const user = global.users[global.userKeys[i]];
|
||||||
// Make sure they are not a tourney user
|
// Make sure they are not a tourney user
|
||||||
if (!user.isTourneyUser && user.uuid != newClientToken) {
|
if (!user.isTourneyUser && user.uuid != newClientToken) {
|
||||||
global.users.splice(i, 1);
|
global.removeUser(user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create user object
|
// Create user object
|
||||||
global.users.push(new User(userDB.id, loginInfo.username, newClientToken, new Date().getTime(), isTourneyClient));
|
global.addUser(newClientToken, new User(userDB.id, loginInfo.username, newClientToken, new Date().getTime(), isTourneyClient));
|
||||||
|
|
||||||
// Retreive the newly created user
|
// Retreive the newly created user
|
||||||
const NewUser = getUserByToken(newClientToken);
|
const NewUser = getUserByToken(newClientToken);
|
||||||
|
|
|
@ -10,14 +10,28 @@ const osu = require("osu-packet"),
|
||||||
DatabaseHelperClass = require("./DatabaseHelper.js"),
|
DatabaseHelperClass = require("./DatabaseHelper.js"),
|
||||||
config = require("../config.json");
|
config = require("../config.json");
|
||||||
|
|
||||||
global.users = [
|
global.users = {};
|
||||||
new User(3, "SillyBot", "SillyBot", new Date().getTime())
|
global.userKeys = Object.keys(global.users);
|
||||||
];
|
|
||||||
|
|
||||||
|
global.addUser = function(uuid, userToAdd) {
|
||||||
|
global.users[uuid] = userToAdd;
|
||||||
|
global.refreshUserKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
global.removeUser = function(userToRemove) {
|
||||||
|
delete userToRemove;
|
||||||
|
global.refreshUserKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
global.refreshUserKeys = function() {
|
||||||
|
global.userKeys = Object.keys(global.users);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the bot user
|
||||||
|
global.addUser("bot", new User(3, "SillyBot", "bot", new Date().getTime()));
|
||||||
// Set the bot's position on the map
|
// Set the bot's position on the map
|
||||||
// First user will always be the bot
|
global.users["bot"].location[0] = 50;
|
||||||
global.users[0].location[0] = 50;
|
global.users["bot"].location[1] = -32;
|
||||||
global.users[0].location[1] = -32;
|
|
||||||
|
|
||||||
global.DatabaseHelper = new DatabaseHelperClass(config.databaseAddress, config.databasePort, config.databaseUsername, config.databasePassword, config.databaseName);
|
global.DatabaseHelper = new DatabaseHelperClass(config.databaseAddress, config.databasePort, config.databaseUsername, config.databasePassword, config.databaseName);
|
||||||
|
|
||||||
|
@ -26,8 +40,8 @@ global.DatabaseHelper = new DatabaseHelperClass(config.databaseAddress, config.d
|
||||||
// TODO: Some way of informing bancho that a user has set a score so details can be pulled down quickly
|
// TODO: Some way of informing bancho that a user has set a score so details can be pulled down quickly
|
||||||
// Possible solution, TCP socket between the score submit server and bancho? redis? (score submit is on a different server, redis probably wouldn't work)
|
// Possible solution, TCP socket between the score submit server and bancho? redis? (score submit is on a different server, redis probably wouldn't work)
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
for (let i = 0; i < global.users.length; i++) {
|
for (let i = 0; i < global.userKeys.length; i++) {
|
||||||
const User = global.users[i];
|
const User = global.users[global.userKeys[i]];
|
||||||
if (User.id == 3) continue; // Ignore the bot
|
if (User.id == 3) continue; // Ignore the bot
|
||||||
// Bot: :(
|
// Bot: :(
|
||||||
|
|
||||||
|
@ -78,7 +92,7 @@ global.httpRequestsPerLogInterval = 0;
|
||||||
const logInterval = 10; // Secs
|
const logInterval = 10; // Secs
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
global.usersOnline = (global.users.length - 1);
|
global.usersOnline = (global.userKeys.length - 1);
|
||||||
global.multiplayerMatches = [global.MultiplayerManager.matches.length, 0]; // TODO: Respect private matches
|
global.multiplayerMatches = [global.MultiplayerManager.matches.length, 0]; // TODO: Respect private matches
|
||||||
|
|
||||||
fs.appendFile(
|
fs.appendFile(
|
||||||
|
@ -94,7 +108,7 @@ if (!fs.existsSync("tHMM.ds")) fs.writeFileSync("tHMM.ds", "0");
|
||||||
global.totalHistoricalMultiplayerMatches = parseInt(fs.readFileSync("tHMM.ds").toString());
|
global.totalHistoricalMultiplayerMatches = parseInt(fs.readFileSync("tHMM.ds").toString());
|
||||||
global.getAndAddToHistoricalMultiplayerMatches = function() {
|
global.getAndAddToHistoricalMultiplayerMatches = function() {
|
||||||
global.totalHistoricalMultiplayerMatches++;
|
global.totalHistoricalMultiplayerMatches++;
|
||||||
fs.writeFile("tHMM.ds", global.totalHistoricalMultiplayerMatches, () => {});
|
fs.writeFile("tHMM.ds", `${global.totalHistoricalMultiplayerMatches}`, () => {});
|
||||||
return global.totalHistoricalMultiplayerMatches;
|
return global.totalHistoricalMultiplayerMatches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module.exports = function(id) {
|
module.exports = function(id) {
|
||||||
for (let i = 0; i < global.users.length; i++) {
|
for (let i = 0; i < global.userKeys.length; i++) {
|
||||||
if (global.users[i].id == id)
|
if (global.users[global.userKeys[i]].id == id)
|
||||||
return global.users[i];
|
return global.users[userKeys[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,4 @@
|
||||||
module.exports = function(token) {
|
module.exports = function(token) {
|
||||||
for (let i = 0; i < global.users.length; i++) {
|
if (global.userKeys.includes(token)) return global.users[token];
|
||||||
if (global.users[i].uuid == token)
|
else return null;
|
||||||
return global.users[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
module.exports = function(username) {
|
module.exports = function(username) {
|
||||||
for (let i = 0; i < global.users.length; i++) {
|
for (let i = 0; i < global.userKeys.length; i++) {
|
||||||
if (global.users[i].username == username)
|
if (global.users[global.userKeys[i]].username == username)
|
||||||
return global.users[i];
|
return global.users[global.userKeys[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue