Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
############
## README ##
############
# The '.env' system in this repository acts as an override for configuration options.
# You do not need to pass in *every* value in here for your '.env', only the ones you want to change.
# For example, if I wanted to change DISCORD_USE_BOT to false but keep everything as the default, the contents of
# '.env' would only have to be 'DISCORD_USE_BOT=false', nothing else.

## ok now the .env.example starts here! ##

# comma-separated discord ids allowed to use mod commands
MODERATORS=discordId,discordId2

DISCORD_USE_BOT=true
DISCORD_BOT_TOKEN=
DISCORD_ENABLE_INGAME_PLAYER_COUNT=true

MONGODB_DATABASE=mongodb://127.0.0.1/Reload

# disabling global chat can help the server perform faster (less resources used)
CHAT_ENABLE_GLOBAL_CHAT=false

ENABLE_DEBUG_LOGS=false
ENABLE_FORMATTED_LOGS=false
ENABLE_REBOOT_USER=true
ENABLE_CROSS_BANS=false

# if you want to use the backend on reboot, leave 3551 as the port
PORT=3551
XMPP_PORT=80
XMPP_PORT_HTTPS=443

API_KEY=ur-api-key
API_REASON_KILL=25
API_REASON_WIN=50

WEBSITE_USE_WEBSITE=false
WEBSITE_CLIENT_ID=your-client-id-here
WEBSITE_CLIENT_SECRET=your-client-secret-here
WEBSITE_REDIRECT_URI=http://127.0.0.1:${WEBSITE_PORT}/oauth2/callback
WEBSITE_PORT=100

# to add more gameservers add ip:port:playlist, comma-separated
# example: 127.0.0.1:7777:example_playlist1,127.0.0.2:7777:example_playlist2
MATCHMAKER_IP=127.0.0.1:80
GAME_SERVER_IP=127.0.0.1:7777:playlist_defaultsolo

# for BATTLEPASS_SEASON enter only the number of your season (2 to 20)
ENABLE_BATTLEPASS=false
BATTLEPASS_SEASON=2

# for VERSION_JOINABLE you can set a season like 9.10, not just 9
ENABLE_ONLY_ONE_VERSION_JOINABLE=false
VERSION_JOINABLE=2

# if USE_AUTO_ROTATE is enabled it will automatically rotate the item shop
# using ROTATE_TIME, SEASON_LIMIT caps which seasons rotate (up to 10 recommended),
# ROTATE_TIME is UTC 24h, ITEM_SHOP_WEBHOOK needs a webhook to your item shop channel
USE_AUTO_ROTATE=false
ENABLE_AUTO_ROTATE_DEBUG_LOGS=false
ENABLE_DISCORD_WEBHOOK=false
CHAPTER_LIMIT=1
SEASON_LIMIT=10
ROTATE_TIME=00:00
EXCLUDED_ITEMS=CID_VIP_Athena_Commando_M_GalileoGondola_SG,CID_636_Athena_Commando_M_GalileoGondola_78MFZ,CID_637_Athena_Commando_M_GalileoOutrigger_7Q0YU,CID_VIP_Athena_Commando_M_GalileoFerry_SG,CID_VIP_Athena_Commando_F_GalileoRocket_SG,CID_568_Athena_Commando_M_RebirthSoldier
ITEM_SHOP_WEBHOOK=
DAILY_ITEMS_AMOUNT=6
FEATURED_ITEMS_AMOUNT=2

# enabling ENABLE_REPORTS turns on in-game reports, rate limited per player
ENABLE_REPORTS=false
REPORT_CHANNEL_ID=your-discord-channel-id-here

# if true, sets all quests except daily quests as completed
COMPLETED_SEASONAL_QUESTS=false

# SAC rewards give the creator-code supporter a % of vbucks spent, in vbucks
# e.g: if your reward % is 25, with an item that is 1000, the SAC code's owner will get 250 vbucks.
ENABLE_SAC_REWARDS=false
PERCENTAGE_SAC_REWARDS=0

# RESTART_TIME format: [number][y,M,w,d,h,m,s], e.g. 5m (capital M = month)
ENABLE_AUTO_BACKEND_RESTART=false
RESTART_TIME=

# sends a message in the channel when the backend comes online
ENABLE_BACKEND_STATUS=false
BACKEND_STATUS_CHANNEL_ID=

# use HTTPS (VPS side, or your own domain A record). needs certs in ssl/
ENABLE_HTTPS=false
SSL_CERT=./ssl/example_certificate.crt
SSL_CA=
SSL_KEY=./ssl/example_private.key

# caldera service is for newer game versions, see CalderaService/guids.json for supported GAME_VERSION
ENABLE_CALDERA_SERVICE=false
GAME_VERSION=27.11
CALDERA_SERVICE_PORT=5000

# in-game world events
ENABLE_GEODE_EVENT=false
GEODE_EVENT_START_DATE=2020-01-01T00:00:00.000Z
ENABLE_CRACK_IN_THE_SKY=false
ENABLE_S4_ODDITY_PRECURSOR=false
ENABLE_S4_ODDITY_EXECUTION=false
S4_ODDITY_EVENT_START_DATE=2020-01-01T00:00:00.000Z
S4_ODDITY_EVENTS_INTERVAL=0
ENABLE_S5_ODDITY_PRECURSOR=false
S5_ODDITY_PRECURSOR_DATE=2020-01-01T00:00:00.000Z
ENABLE_S5_ODDITY_EXECUTION=false
S5_ODDITY_EXECUTION_DATE=2020-01-01T00:00:00.000Z
ENABLE_CUBE_LIGHTNING=false
CUBE_SPAWN_DATE=2020-01-01T00:00:00.000Z
ENABLE_BLOCKBUSTER_RISKY_EVENT=false
ENABLE_CUBE_LAKE=false
CUBE_LAKE_DATE=2020-01-01T00:00:00.000Z
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ClientSettings/
*.Sav
node_modules/
.env
10 changes: 6 additions & 4 deletions Api/launcher.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const bcrypt = require("bcryptjs");
const express = require("express");
const app = express.Router();

const User = require("../model/user.js");
const log = require("../structs/log.js");
const bcrypt = require("bcrypt");

//Api for launcher login (If u want a POST requesto just replace "app.get" to "app.post" and "req.query" to "req.body")
const app = express.Router();

// Api for launcher login (If u want a POST requesto just replace "app.get" to "app.post" and "req.query" to "req.body")
app.get("/api/launcher/login", async (req, res) => {
const { email, password } = req.query;

Expand All @@ -27,7 +29,7 @@ app.get("/api/launcher/login", async (req, res) => {
return res.status(400).send('Error!');
}
} catch (err) {
log.error('Launcher Api Error:', err);
log.error('Launcher API Error:', err);
return res.status(500).send('Error encountered, look at the console');
}
});
Expand Down
2 changes: 1 addition & 1 deletion Api/vbucks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const Profile = require("../model/profiles.js");
const log = require("../structs/log.js");
const fs = require("fs");
const uuid = require("uuid");
const config = JSON.parse(fs.readFileSync("./Config/config.json").toString());
const config = require('../Config/config.js');

app.get("/api/reload/vbucks", async (req, res) => {
const { apikey, username, reason } = req.query;
Expand Down
3 changes: 1 addition & 2 deletions CalderaService/tokencreator.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const jwt = require("jsonwebtoken");
const fs = require("fs");

const guids = require("./guids.json")

const config = JSON.parse(fs.readFileSync("./Config/config.json").toString());
const config = require('../Config/config.js');

var CalderaGenerated = 0;

Expand Down
142 changes: 142 additions & 0 deletions Config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
require('dotenv').config();

function bool(key, fallback) {
const raw = process.env[key];
if (raw === undefined || raw === '') return fallback;
return raw === 'true' || raw === '1';
}

function num(key, fallback) {
const raw = process.env[key];
if (raw === undefined || raw === '') return fallback;
return Number(raw);
}

function str(key, fallback) {
const raw = process.env[key];
return raw === undefined ? fallback : raw;
}

function arr(key, fallback) {
const raw = process.env[key];
if (raw === undefined || raw === '') return fallback;
return raw.split(',').map((item) => item.trim());
}

const websitePort = num('WEBSITE_PORT', 100);

const config = {
moderators: arr('MODERATORS', []),

discord: {
bUseDiscordBot: bool('DISCORD_USE_BOT', true),
bot_token: str('DISCORD_BOT_TOKEN', ''),
bEnableInGamePlayerCount: bool('DISCORD_ENABLE_INGAME_PLAYER_COUNT', true),
},

mongodb: {
database: str('MONGODB_DATABASE', 'mongodb://127.0.0.1/Reload'),
},

chat: {
EnableGlobalChat: bool('CHAT_ENABLE_GLOBAL_CHAT', false),
},

bEnableDebugLogs: bool('ENABLE_DEBUG_LOGS', false),
bEnableFormattedLogs: bool('ENABLE_FORMATTED_LOGS', false),
bEnableRebootUser: bool('ENABLE_REBOOT_USER', true),
bEnableCrossBans: bool('ENABLE_CROSS_BANS', false),

port: num('PORT', 3551),
xmppPort: num('XMPP_PORT', 80),
xmppPortHTTPS: num('XMPP_PORT_HTTPS', 443),

Api: {
bApiKey: str('API_KEY', 'ur-api-key'),
reasons: {
Kill: num('API_REASON_KILL', 25),
Win: num('API_REASON_WIN', 50),
},
},

Website: {
bUseWebsite: bool('WEBSITE_USE_WEBSITE', false),
clientId: str('WEBSITE_CLIENT_ID', 'your-client-id-here'),
clientSecret: str('WEBSITE_CLIENT_SECRET', 'your-client-secret-here'),
websitePort: websitePort,
redirectUri: str(
'WEBSITE_REDIRECT_URI',
'http://127.0.0.1:${websitePort}/oauth2/callback'
).replace('${websitePort}', websitePort),
},

matchmakerIP: str('MATCHMAKER_IP', '127.0.0.1:80'),
gameServerIP: arr('GAME_SERVER_IP', ['127.0.0.1:7777:playlist_defaultsolo']),

bEnableBattlepass: bool('ENABLE_BATTLEPASS', false),
bBattlePassSeason: num('BATTLEPASS_SEASON', 2),

bEnableOnlyOneVersionJoinable: bool('ENABLE_ONLY_ONE_VERSION_JOINABLE', false),
bVersionJoinable: num('VERSION_JOINABLE', 2),

bUseAutoRotate: bool('USE_AUTO_ROTATE', false),
bEnableAutoRotateDebugLogs: bool('ENABLE_AUTO_ROTATE_DEBUG_LOGS', false),
bEnableDiscordWebhook: bool('ENABLE_DISCORD_WEBHOOK', false),
bChapterlimit: str('CHAPTER_LIMIT', '1'),
bSeasonlimit: str('SEASON_LIMIT', '10'),
bRotateTime: str('ROTATE_TIME', '00:00'),
bExcludedItems: arr('EXCLUDED_ITEMS', [
'CID_VIP_Athena_Commando_M_GalileoGondola_SG',
'CID_636_Athena_Commando_M_GalileoGondola_78MFZ',
'CID_637_Athena_Commando_M_GalileoOutrigger_7Q0YU',
'CID_VIP_Athena_Commando_M_GalileoFerry_SG',
'CID_VIP_Athena_Commando_F_GalileoRocket_SG',
'CID_568_Athena_Commando_M_RebirthSoldier',
]),
bItemShopWebhook: str('ITEM_SHOP_WEBHOOK', ''),
bDailyItemsAmount: num('DAILY_ITEMS_AMOUNT', 6),
bFeaturedItemsAmount: num('FEATURED_ITEMS_AMOUNT', 2),

bEnableReports: bool('ENABLE_REPORTS', false),
bReportChannelId: str('REPORT_CHANNEL_ID', 'your-discord-channel-id-here'),

bCompletedSeasonalQuests: bool('COMPLETED_SEASONAL_QUESTS', false),

bEnableSACRewards: bool('ENABLE_SAC_REWARDS', false),
bPercentageSACRewards: num('PERCENTAGE_SAC_REWARDS', 0),

bEnableAutoBackendRestart: bool('ENABLE_AUTO_BACKEND_RESTART', false),
bRestartTime: str('RESTART_TIME', ''),

bEnableBackendStatus: bool('ENABLE_BACKEND_STATUS', false),
bBackendStatusChannelId: str('BACKEND_STATUS_CHANNEL_ID', ''),

bEnableHTTPS: bool('ENABLE_HTTPS', false),
ssl: {
cert: str('SSL_CERT', './ssl/example_certificate.crt'),
key: str('SSL_KEY', './ssl/example_private.key'),
},

bEnableCalderaService: bool('ENABLE_CALDERA_SERVICE', false),
bGameVersion: str('GAME_VERSION', '27.11'),
bCalderaServicePort: num('CALDERA_SERVICE_PORT', 5000),

bEnableGeodeEvent: bool('ENABLE_GEODE_EVENT', false),
geodeEventStartDate: str('GEODE_EVENT_START_DATE', '2020-01-01T00:00:00.000Z'),
bEnableCrackInTheSky: bool('ENABLE_CRACK_IN_THE_SKY', false),
bEnableS4OddityPrecursor: bool('ENABLE_S4_ODDITY_PRECURSOR', false),
bEnableS4OddityExecution: bool('ENABLE_S4_ODDITY_EXECUTION', false),
S4OddityEventStartDate: str('S4_ODDITY_EVENT_START_DATE', '2020-01-01T00:00:00.000Z'),
S4OddityEventsInterval: num('S4_ODDITY_EVENTS_INTERVAL', 0),
bEnableS5OddityPrecursor: bool('ENABLE_S5_ODDITY_PRECURSOR', false),
S5OddityPrecursorDate: str('S5_ODDITY_PRECURSOR_DATE', '2020-01-01T00:00:00.000Z'),
bEnableS5OddityExecution: bool('ENABLE_S5_ODDITY_EXECUTION', false),
S5OddityExecutionDate: str('S5_ODDITY_EXECUTION_DATE', '2020-01-01T00:00:00.000Z'),
bEnableCubeLightning: bool('ENABLE_CUBE_LIGHTNING', false),
cubeSpawnDate: str('CUBE_SPAWN_DATE', '2020-01-01T00:00:00.000Z'),
bEnableBlockbusterRiskyEvent: bool('ENABLE_BLOCKBUSTER_RISKY_EVENT', false),
bEnableCubeLake: bool('ENABLE_CUBE_LAKE', false),
cubeLakeDate: str('CUBE_LAKE_DATE', '2020-01-01T00:00:00.000Z'),
};

module.exports = config;
Loading