Compare commits

..

2 Commits

Author SHA1 Message Date
mqiy
eeae564ea6
Update banners
The randomness of the results obtained by the card drawing is changed.
2022-08-10 23:16:54 +08:00
minqiy
de2a4fbd4d
banners
Fix for more characters and light cones; fix for only Seer and March 7
2022-08-10 15:39:48 +08:00
9 changed files with 558 additions and 374 deletions

545
banners Normal file
View File

@ -0,0 +1,545 @@
[
{
"gachaId": 1001,
"detailWebview": "",
"rateUpItems4": [
1001,
1002,
1008,
1009,
1013,
1103,
1105,
1106,
1108,
1109,
1206,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
21000,
21001,
21002,
21003,
21004,
21006,
21005,
21007,
21008,
21009,
21010,
21011,
21012,
21013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013
],
"rateUpItems5": [
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
1003,
1004,
1101,
1104,
1107,
1101,
23000,
23001,
23002,
23003,
23004
],
"costItemId": 1100
},
{
"gachaId": 2001,
"detailWebview": "",
"rateUpItems4": [
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
1001,
1008,
1105,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
1102,
1001,
1008
],
"rateUpItems5": [
20000
20001,
1102,
1001,
1008,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
1102,
1001,
1008,
1105,
1105
],
"costItemId": 1100
},
{
"gachaId": 2002,
"detailWebview": "",
"rateUpItems4": [
1002,
1009,
1013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
1002,
1009,
1013
],
"rateUpItems5": [
1204,
1013,
1009,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
1204,
1002,
1009,
1002,
1009,
1013
],
"costItemId": 1100
},
{
"gachaId": 3001,
"detailWebview": "",
"rateUpItems4": [
21000,
21002,
21012,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
21000,
21002,
21012
],
"rateUpItems5": [
23001,
21000,
21002,
21012,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
21000,
21002,
21012,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013
],
"costItemId": 1100
},
{
"gachaId": 3002,
"detailWebview": "",
"rateUpItems4": [
21003,
21004,
21006,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
21003,
21004,
21006,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013
],
"rateUpItems5": [
23010,
21003,
21004,
21006,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
20000,
20001,
20002,
21003,
21004,
21006,
23010
],
"costItemId": 1100
},
{
"gachaId": 4001,
"detailWebview": "",
"rateUpItems4": [
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
1001,
1002,
1008,
1009,
1013,
1103,
1105,
1106,
1108,
1109,
1206,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
21000,
21001,
21002,
21003,
21004,
21006,
21005,
21007,
21008,
21009,
21010,
21011,
21012,
21013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013
],
"rateUpItems5": [
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20006,
20007,
20008,
1003,
1004,
1101,
1104,
1107,
1101,
20000,
20001,
20002,
20003,
20004,
20005,
20006,
20007,
20008,
20009,
20010,
20011,
20012,
20013
],
"costItemId": 1100
}
]

11
package-lock.json generated
View File

@ -12,7 +12,6 @@
"mongodb": "^4.8.0",
"node-kcp-token": "github:memetrollsxd/node-kcp",
"protobufjs": "^7.0.0",
"rcon-server": "^0.1.1",
"typescript": "^4.7.4"
},
"devDependencies": {
@ -1203,11 +1202,6 @@
"node": ">= 0.8"
}
},
"node_modules/rcon-server": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/rcon-server/-/rcon-server-0.1.1.tgz",
"integrity": "sha512-oJ9+s0yxGc7in6GBBBxFXKRY2OyIVxFsoAEHlo5iFXDCuK6O4gY4qJ9XndMBVmA+nABkyOrN6QAFzoE6wZiI7A=="
},
"node_modules/readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
@ -2574,11 +2568,6 @@
"unpipe": "1.0.0"
}
},
"rcon-server": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/rcon-server/-/rcon-server-0.1.1.tgz",
"integrity": "sha512-oJ9+s0yxGc7in6GBBBxFXKRY2OyIVxFsoAEHlo5iFXDCuK6O4gY4qJ9XndMBVmA+nABkyOrN6QAFzoE6wZiI7A=="
},
"readdirp": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",

View File

@ -13,7 +13,6 @@
"mongodb": "^4.8.0",
"node-kcp-token": "github:memetrollsxd/node-kcp",
"protobufjs": "^7.0.0",
"rcon-server": "^0.1.1",
"typescript": "^4.7.4"
}
}
}

View File

@ -27,14 +27,22 @@ export default class Interface {
private constructor() { }
public static start() {
public static readonly start = () => {
Interface.rl.question("", (_command) => {
if (!_command) {
Interface.start();
return;
}
const cmd = new Command(_command);
Interface.handle(cmd);
import(`./${alias[cmd.name] || cmd.name}`).then(async module => {
await module.default(cmd);
}).catch(err => {
if (err.code == "MODULE_NOT_FOUND") {
c.log(`Command ${cmd.name} not found.`);
return;
}
c.error(err);
});
Interface.start();
});
@ -43,16 +51,4 @@ export default class Interface {
process.exit(0);
});
}
public static handle(cmd: Command) {
import(`./${alias[cmd.name] || cmd.name}`).then(async module => {
await module.default(cmd);
}).catch(err => {
if (err.code == "MODULE_NOT_FOUND") {
c.log(`Command ${cmd.name} not found.`);
return;
}
c.error(err);
});
}
}

View File

@ -1,14 +0,0 @@
import SRServer from "../server/kcp/SRServer";
import Logger from "../util/Logger";
import { Command } from "./Interface";
const c = new Logger("/kickall", "blue");
export default async function handle(command: Command) {
const hard = command.args[0];
for (const [key, session] of SRServer.getInstance().sessions) {
session.kick(!!hard);
}
c.log(`Kicked all players. Hard kick: ${!!hard}`);
}

View File

@ -6,7 +6,6 @@
import Interface from "./commands/Interface";
import HttpServer from "./http/HttpServer";
import SRServer from "./server/kcp/SRServer";
import RCONServer from "./server/rcon/RCONServer";
import Banners from "./util/Banner";
import Logger from "./util/Logger";
import ProtoFactory from "./util/ProtoFactory"
@ -16,7 +15,6 @@ c.log(`Starting CrepeSR...`);
Banners.init();
ProtoFactory.init();
Interface.start();
Interface.start();
HttpServer.getInstance().start();
SRServer.getInstance().start();
RCONServer.getInstance().start();
SRServer.getInstance().start();

View File

@ -1,54 +0,0 @@
// @ts-ignore
import { RCONServer as RServer } from "rcon-server";
import { Writable } from "stream";
import Interface, { Command } from "../../commands/Interface";
import Config from "../../util/Config";
import Logger from "../../util/Logger";
const c = new Logger("RCON", "green");
export default class RCONServer {
private static _instance: RCONServer;
public RCON!: RServer;
private constructor() { }
public static getInstance(): RCONServer {
if (!this._instance) this._instance = new RCONServer();
return this._instance;
}
public start() {
if (!Config.RCON.RCON_ENABLED) return;
this.RCON = new RServer({
host: Config.HTTP.HTTP_HOST,
clientLimit: Config.RCON.RCON_CLIENT_LIMIT,
destroySocketOnLimitExceeded: false,
emitAdvancedEvents: false,
password: Config.RCON.RCON_PASSWORD,
port: Config.RCON.RCON_PORT
});
this.RCON.on("listening", () => {
c.log(`Listening on ${Config.RCON.RCON_PORT}`);
});
this.RCON.on("commandRequest", (cmd: {
size: number,
id: number,
type: number,
body: string
resolve: (value: string) => void,
}) => {
c.verbL(cmd);
Interface.handle(new Command(cmd.body));
cmd.resolve(`Command executed.`);
});
this.RCON.on("login", ({ pw, fail }: { pw: string, fail: boolean }) => {
c.debug(pw);
fail ? c.log(`Login failed`) : c.log(`Login successful`); // For some reason succ is flipped
});
this.RCON.connect();
}
}

View File

@ -1,263 +0,0 @@
/** Declaration file generated by dts-gen */
import { EventEmitter } from "events";
declare module "rcon-server" {
export class RCONServer extends EventEmitter {
constructor(obj: {
port: number = 3839,
host: string = "127.0.0.1",
password: string = "password",
clientLimit: number = 1,
destroySocketOnLimitExceeded: boolean = true,
emitAdvancedEvents: boolean = false
});
connect(...args: any[]): void;
getConnectedSockets(...args: any[]): void;
getServerSettings(...args: any[]): void;
getSocketServer(...args: any[]): void;
static captureRejectionSymbol: any;
static captureRejections: boolean;
static defaultMaxListeners: number;
static errorMonitor: any;
static getEventListeners(emitterOrTarget: any, type: any): any;
static init(opts: any): void;
static kMaxEventTargetListeners: any;
static kMaxEventTargetListenersWarned: any;
static listenerCount(emitter: any, type: any): any;
static on(emitter: any, event: any, options: any): any;
static once(emitter: any, name: any, options: any): any;
static setMaxListeners(n: any, eventTargets: any): void;
static usingDomains: boolean;
}
export namespace RCONServer {
class EventEmitter {
constructor(opts: any);
addListener(type: any, listener: any): any;
emit(type: any, args: any): any;
eventNames(): any;
getMaxListeners(): any;
listenerCount(type: any): any;
listeners(type: any): any;
off(type: any, listener: any): any;
on(type: any, listener: any): any;
once(type: any, listener: any): any;
prependListener(type: any, listener: any): any;
prependOnceListener(type: any, listener: any): any;
rawListeners(type: any): any;
removeAllListeners(type: any, ...args: any[]): any;
removeListener(type: any, listener: any): any;
setMaxListeners(n: any): any;
static EventEmitter: any;
static captureRejectionSymbol: any;
static captureRejections: boolean;
static defaultMaxListeners: number;
static errorMonitor: any;
static getEventListeners(emitterOrTarget: any, type: any): any;
static init(opts: any): void;
static kMaxEventTargetListeners: any;
static kMaxEventTargetListenersWarned: any;
static listenerCount(emitter: any, type: any): any;
static on(emitter: any, event: any, options: any): any;
static once(emitter: any, name: any, options: any): any;
static setMaxListeners(n: any, eventTargets: any): void;
static usingDomains: boolean;
}
class EventEmitterAsyncResource {
constructor(...args: any[]);
emit(...args: any[]): void;
emitDestroy(...args: any[]): void;
static EventEmitterAsyncResource: any;
static captureRejectionSymbol: any;
static captureRejections: boolean;
static defaultMaxListeners: number;
static errorMonitor: any;
static getEventListeners(emitterOrTarget: any, type: any): any;
static init(opts: any): void;
static kMaxEventTargetListeners: any;
static kMaxEventTargetListenersWarned: any;
static listenerCount(emitter: any, type: any): any;
static on(emitter: any, event: any, options: any): any;
static once(emitter: any, name: any, options: any): any;
static setMaxListeners(n: any, eventTargets: any): void;
static usingDomains: boolean;
}
namespace EventEmitter {
class EventEmitterAsyncResource {
constructor(...args: any[]);
emit(...args: any[]): void;
emitDestroy(...args: any[]): void;
static EventEmitter: any;
static EventEmitterAsyncResource: any;
static captureRejectionSymbol: any;
static captureRejections: boolean;
static defaultMaxListeners: number;
static errorMonitor: any;
static getEventListeners(emitterOrTarget: any, type: any): any;
static init(opts: any): void;
static kMaxEventTargetListeners: any;
static kMaxEventTargetListenersWarned: any;
static listenerCount(emitter: any, type: any): any;
static on(emitter: any, event: any, options: any): any;
static once(emitter: any, name: any, options: any): any;
static setMaxListeners(n: any, eventTargets: any): void;
static usingDomains: boolean;
}
}
namespace EventEmitterAsyncResource {
class EventEmitter {
constructor(opts: any);
addListener(type: any, listener: any): any;
emit(type: any, args: any): any;
eventNames(): any;
getMaxListeners(): any;
listenerCount(type: any): any;
listeners(type: any): any;
off(type: any, listener: any): any;
on(type: any, listener: any): any;
once(type: any, listener: any): any;
prependListener(type: any, listener: any): any;
prependOnceListener(type: any, listener: any): any;
rawListeners(type: any): any;
removeAllListeners(type: any, ...args: any[]): any;
removeListener(type: any, listener: any): any;
setMaxListeners(n: any): any;
static EventEmitter: any;
static EventEmitterAsyncResource: any;
static captureRejectionSymbol: any;
static captureRejections: boolean;
static defaultMaxListeners: number;
static errorMonitor: any;
static getEventListeners(emitterOrTarget: any, type: any): any;
static init(opts: any): void;
static kMaxEventTargetListeners: any;
static kMaxEventTargetListenersWarned: any;
static listenerCount(emitter: any, type: any): any;
static on(emitter: any, event: any, options: any): any;
static once(emitter: any, name: any, options: any): any;
static setMaxListeners(n: any, eventTargets: any): void;
static usingDomains: boolean;
}
}
}
}

View File

@ -28,12 +28,6 @@ const DEFAULT_CONFIG = {
MAINTENANCE: false,
MAINTENANCE_MSG: "Server is in maintenance mode."
},
RCON: {
RCON_ENABLED: false,
RCON_PASSWORD: "password",
RCON_PORT: 22103,
RCON_CLIENT_LIMIT: 1
},
AUTO_ACCOUNT: false
}
type DefaultConfig = typeof DEFAULT_CONFIG;
@ -88,12 +82,6 @@ export default class Config {
MAINTENANCE_MSG: string;
} = Config.config.GAMESERVER;
public static AUTO_ACCOUNT: boolean = Config.config.AUTO_ACCOUNT;
public static RCON: {
RCON_ENABLED: boolean;
RCON_PASSWORD: string;
RCON_PORT: number;
RCON_CLIENT_LIMIT: number;
} = Config.config.RCON;
private constructor() { }
}