1
0
mirror of synced 2025-02-08 15:28:14 +01:00
Bayshore/src/config.ts

51 lines
1.3 KiB
TypeScript
Raw Normal View History

import fs from 'fs';
export interface ConfigFile {
shopName: string;
shopNickname: string;
2022-07-13 18:09:13 +01:00
regionName: string;
serverIp?: string;
gameOptions: GameOptions;
2022-07-17 15:14:23 +01:00
unix?: UnixOptions;
2022-07-17 15:01:48 +01:00
notices?: string[];
2022-07-18 11:08:13 +01:00
sentryDsn?: string;
2022-07-17 15:14:23 +01:00
}
export interface UnixOptions {
setuid: number;
setgid: number;
}
export interface GameOptions {
// If set to 1, all scratch rewards will be granted to players (including cars)
grantAllScratchRewards: number;
// If set to 1, gives the player a random colour for each of the special cars.
// If set to 2, allows the player to pick any of the colours (more cluttered)
grantBonusScratchCars: number;
// If set to 1, all gift cars (i.e. S2000, S660, etc. will be fully tuned.)
// If set to 0, they will be left at their default tune (i.e. stock, basic tune, etc.)
giftCarsFullyTuned: number,
// Amount of full-tunes to grant to newly registered cards
grantFullTuneTicketToNewUsers: number;
}
export class Config {
private static cfg: ConfigFile;
static load() {
console.log('Loading config file...');
let cfg = fs.readFileSync('./config.json', 'utf-8');
let json = JSON.parse(cfg);
this.cfg = json as ConfigFile;
}
static getConfig(): ConfigFile {
2022-07-13 18:09:13 +01:00
if (!this.cfg)
this.load();
return this.cfg;
}
}