mirror of
https://github.com/laochan-eacnet/backend.git
synced 2026-10-08 22:39:48 +03:00
ddr support wip
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { sdvx } from "../../decorators/eacnet.js";
|
||||
import { generic } from "../../decorators/eacnet.js";
|
||||
import { Context } from "../../types.js";
|
||||
import { Serializable, v } from "../../utils/kxml-value.js";
|
||||
import * as data from '../../datas/sdvx.js';
|
||||
|
||||
export class AcRelay {
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_play_e(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
@@ -19,7 +19,7 @@ export class AcRelay {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_play_s(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
@@ -35,7 +35,7 @@ export class AcRelay {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_hiscore() {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
@@ -51,7 +51,7 @@ export class AcRelay {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_log(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
@@ -66,7 +66,7 @@ export class AcRelay {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_common(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
@@ -98,7 +98,7 @@ export class AcRelay {
|
||||
}
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_music_url(ctx: Context): Promise<Serializable> {
|
||||
let { music_id } = ctx.body as { music_id: number | number[] };
|
||||
if (typeof music_id === 'number') {
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import { sdvx } from "../../decorators/eacnet.js";
|
||||
import { Combine } from "../../utils/combine.js";
|
||||
import config from "../../utils/config.js";
|
||||
import { Serializable, v } from "../../utils/kxml-value.js";
|
||||
import { AcRelay } from "./ac-relay.js";
|
||||
import { UserService } from "../../services/sdvx/user.js";
|
||||
import { inject, singleton } from "tsyringe";
|
||||
import { User } from "./user.js";
|
||||
import { Music } from "./music.js";
|
||||
import { EacGeneric } from "../eac-generic.js";
|
||||
|
||||
@singleton()
|
||||
export default class extends Combine(AcRelay, User, Music) {
|
||||
export default class extends Combine(AcRelay, User, Music, EacGeneric) {
|
||||
constructor(
|
||||
@inject(UserService) private readonly userService: UserService,
|
||||
) {
|
||||
@@ -17,142 +15,4 @@ export default class extends Combine(AcRelay, User, Music) {
|
||||
|
||||
this.userService;
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
async heartbeat(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
state: v.s32(1),
|
||||
next_clock: v.u64(new Date().valueOf() + 36e5),
|
||||
server_state: v.s32(1),
|
||||
mainte_start_clock: v.u64(0),
|
||||
mainte_end_clock: v.u64(0),
|
||||
usta_boot_status: v.s32(1),
|
||||
usta_time_remain: v.s32(0),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
async checkVersion(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
permission: v.s32(1),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
async getServerClock(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
server_clock: v.u64(new Date().valueOf()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
async getServerState(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
server_state: v.s32(1),
|
||||
mainte_start_clock: v.u64(0),
|
||||
mainte_end_clock: v.u64(0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@sdvx('SHIFT_JIS')
|
||||
async getServices(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
service_num: v.s32(18),
|
||||
service: [
|
||||
{
|
||||
service_name: v.str('acRelay'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/AcRelay`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('cancelReserveConsumeItem'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/CancelReserveConsumeItem`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('checkGameStart'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/CheckGameStart`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('checkVersion'),
|
||||
url: v.str(`${config.selfUrl}/needless_auth/CheckVersion`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('consumeItem'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/ConsumeItem`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getGoodsList'),
|
||||
url: v.str(`${config.selfUrl}/needless_auth/GetGoodsList`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getHash'),
|
||||
url: v.str(`${config.selfUrl}/needless_auth/GetHash`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getItemList'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/GetItemList`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getLauncherData'),
|
||||
url: v.str(`${config.selfUrl}/needless_auth/GetLauncherData`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getResourceInfo'),
|
||||
url: v.str(`${config.selfUrl}/needless_auth/GetResourceInfo`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getServerClock'),
|
||||
url: v.str(`${config.selfUrl}/pre_process/GetServerClock`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getServerState'),
|
||||
url: v.str(`${config.selfUrl}/pre_process/GetServerStatus`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getServices'),
|
||||
url: v.str(`${config.selfUrl}/pre_process/GetServices`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getSubscriptionStatus'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/GetSubscriptionStatus`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('getUserIDs'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/GetUserId`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('heartbeat'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/Heartbeat`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('reserveConsumeItem'),
|
||||
url: v.str(`${config.selfUrl}/need_auth/ReserveConsumeItem`),
|
||||
},
|
||||
{
|
||||
service_name: v.str('uploadFile'),
|
||||
url: v.str(`${config.selfUrl}/needless_auth/UploadFile`),
|
||||
},
|
||||
|
||||
],
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { sdvx } from "../../decorators/eacnet.js";
|
||||
import { generic } from "../../decorators/eacnet.js";
|
||||
import { UserService } from "../../services/sdvx/user.js";
|
||||
import { Serializable, v } from "../../utils/kxml-value.js";
|
||||
import { Context } from "../../types.js";
|
||||
@@ -7,7 +7,7 @@ import { PlayerMusicData, PlayerPlayLog } from "../../types/sdvx/index.js";
|
||||
export class Music {
|
||||
userService: UserService;
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_save_m(ctx: Context): Promise<Serializable> {
|
||||
const { track } = ctx.body as { track: PlayerPlayLog };
|
||||
|
||||
@@ -74,7 +74,7 @@ export class Music {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_load_r(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
@@ -94,7 +94,7 @@ export class Music {
|
||||
* score exscore clear_type score_grade max_chain play_count btn_rate long_rate vol_rate
|
||||
* 0 0 0 0 0 timestamp_s 0 0 0 0 0 0
|
||||
*/
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_load_m(ctx: Context): Promise<Serializable> {
|
||||
const mdata = await this.userService.getPlayerMusicDatas(ctx.token);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as data from '../../datas/sdvx.js';
|
||||
import { tokenToCardNumber, tokenToHash, tokenToSnsId } from "../../utils/laochan-id.js";
|
||||
import { Context } from "../../types.js";
|
||||
import { sdvx } from '../../decorators/eacnet.js';
|
||||
import { generic } from '../../decorators/eacnet.js';
|
||||
import { KValueG, Serializable, ValueTypes, v } from '../../utils/kxml-value.js';
|
||||
import { UserService } from '../../services/sdvx/user.js';
|
||||
import { Item, Param } from '../../types/sdvx/savedata.js';
|
||||
@@ -90,7 +90,7 @@ export function tryMergeParam(params: Param[], newParams: object[]) {
|
||||
export class User {
|
||||
userService: UserService;
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_save_c(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
@@ -106,7 +106,7 @@ export class User {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_save(ctx: Context): Promise<Serializable> {
|
||||
const playData = await this.userService.getPlayerData(ctx.token);
|
||||
if (!playData) {
|
||||
@@ -168,7 +168,7 @@ export class User {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_new(ctx: Context): Promise<Serializable> {
|
||||
await this.userService.createEmptyPlayerData(ctx.token, ctx.body.name);
|
||||
|
||||
@@ -185,7 +185,7 @@ export class User {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async sv6_load(ctx: Context): Promise<Serializable> {
|
||||
const playData = await this.userService.getPlayerData(ctx.token);
|
||||
|
||||
@@ -227,7 +227,7 @@ export class User {
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
@generic()
|
||||
async getItemList(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
@@ -242,43 +242,4 @@ export class User {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
async getGoodsList(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
goods_num: v.s32(0),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
async getUserIDs(ctx: Context): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
card_num: v.str(tokenToCardNumber(ctx.token)),
|
||||
ref_id: v.str(tokenToHash(ctx.token)),
|
||||
data_id: v.str(tokenToHash(ctx.token)),
|
||||
sns_id: v.str(tokenToSnsId(ctx.token)),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@sdvx()
|
||||
async getSubscriptionStatus(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
subscription: {
|
||||
name: v.str('eac_sdvx_basic'),
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user