mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-03-22 01:44:39 -05:00
24 lines
626 B
TypeScript
24 lines
626 B
TypeScript
import {Counter} from './models/counter';
|
|
|
|
export function IDToCode(id: number) {
|
|
const padded = _.padStart(id.toString(), 8);
|
|
return `${padded.slice(0, 4)}-${padded.slice(4)}`;
|
|
}
|
|
|
|
export async function GetCounter(key: string) {
|
|
return (
|
|
await DB.Upsert<Counter>(
|
|
{ collection: 'counter', key: 'mix' },
|
|
{ $inc: { value: 1 } }
|
|
)
|
|
).docs[0].value;
|
|
}
|
|
|
|
export function getVersion(info: EamuseInfo) {
|
|
const dateCode = parseInt(info.model.split(":")[4]);
|
|
if (dateCode <= 2013052900) return 1;
|
|
if (info.method.startsWith('sv4')) return 4;
|
|
if (info.method.startsWith('sv5')) return 5;
|
|
return 0;
|
|
}
|