mirror of
https://github.com/laochan-eacnet/backend.git
synced 2026-09-22 22:28:11 +03:00
ddr support wip
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
import { singleton } from "tsyringe";
|
||||
import { Combine } from "../../utils/combine.js";
|
||||
import { generic } from "../../decorators/eacnet.js";
|
||||
import { Serializable, v } from "../../utils/kxml-value.js";
|
||||
import config from "../../utils/config.js";
|
||||
import { EacGeneric } from "../eac-generic.js";
|
||||
import * as data from '../../datas/ddr.js'
|
||||
|
||||
@singleton()
|
||||
export default class extends Combine(EacGeneric) {
|
||||
@generic()
|
||||
async getItemList(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
item_num: v.s32(1),
|
||||
item: {
|
||||
item_id: v.str('DDR_TICKET'),
|
||||
not_free_count: v.s32(0),
|
||||
free_count: v.s32(114514),
|
||||
buyable_point: v.s32(0),
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@generic()
|
||||
async log_2_save(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
xrpc_status_code: v.s32(0),
|
||||
xrpc_fault_code: v.s32(0),
|
||||
response: {
|
||||
log_2: {
|
||||
$status: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get Preview
|
||||
@generic()
|
||||
async getprev(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
xrpc_status_code: v.s32(0),
|
||||
xrpc_fault_code: v.s32(0),
|
||||
response: {
|
||||
fileinfo_2: {
|
||||
$status: 0,
|
||||
soundinfo: data.soundInfos,
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@generic()
|
||||
async getmusic(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
xrpc_status_code: v.s32(0),
|
||||
xrpc_fault_code: v.s32(0),
|
||||
response: {
|
||||
data_2: {
|
||||
$status: 0,
|
||||
mdb: {
|
||||
music: data.musics,
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import { generic } from "../../decorators/eacnet.js";
|
||||
import { Context } from "../../types.js";
|
||||
import { Serializable, v } from "../../utils/kxml-value.js";
|
||||
import { musicPackMax } from "../../datas/ddr.js";
|
||||
import { constants } from "node:fs";
|
||||
|
||||
export class User {
|
||||
async _usernew(token: string): Promise<Serializable> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async _userload(token: string): Promise<Serializable> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async _ghostload(token: string): Promise<Serializable> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async _usersave(token: string, data: any): Promise<Serializable> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async _rivalload(token: string, data: any): Promise<Serializable> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async _inheritance(token: string, data: any): Promise<Serializable> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async _arcadeload(token: string, data: any): Promise<Serializable> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async _linkage_pre_playable(token: string, data: any): Promise<Serializable> {
|
||||
return {};
|
||||
}
|
||||
|
||||
async _mpackload() {
|
||||
return {
|
||||
mpacklist: new Array(musicPackMax).map(() => ({
|
||||
pre_playable_id: v.str(''),
|
||||
permit_freeplay: v.bool(false),
|
||||
is_purchased: v.bool(true),
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
||||
@generic()
|
||||
async usergamedata_advanced(ctx: Context): Promise<Serializable> {
|
||||
const { data: { mode } } = ctx.body as {
|
||||
data: {
|
||||
mode: string,
|
||||
refid: string,
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
xrpc_status_code: v.s32(0),
|
||||
xrpc_fault_code: v.s32(0),
|
||||
response: {
|
||||
playerdata_2: await {
|
||||
'usernew': this._usernew,
|
||||
'userload': this._userload,
|
||||
'ghostload': this._ghostload,
|
||||
'usersave': this._usersave,
|
||||
'rivalload': this._rivalload,
|
||||
'inheritance': this._inheritance,
|
||||
'arcadeload': this._arcadeload,
|
||||
'mpackload': this._mpackload,
|
||||
'linkage_pre_playable': this._linkage_pre_playable,
|
||||
}[mode].apply(this, [ctx.token, ctx.body]),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Context } from '../types.js';
|
||||
import { p2d, sdvx } from '../decorators/eacnet.js';
|
||||
import { generic, p2d } from '../decorators/eacnet.js';
|
||||
import { v } from '../utils/kxml-value.js';
|
||||
import { singleton } from 'tsyringe';
|
||||
|
||||
@@ -17,7 +17,7 @@ export class DefaultService {
|
||||
|
||||
p2d()(undefined, undefined, descriptor);
|
||||
return descriptor.value();
|
||||
} else if (ctx.service.name === 'sdvx') {
|
||||
} else if (['sdvx', 'ddr'].includes(ctx.service.name)) {
|
||||
const result = {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
@@ -39,7 +39,7 @@ export class DefaultService {
|
||||
value: () => result,
|
||||
};
|
||||
|
||||
sdvx()(undefined, undefined, descriptor);
|
||||
generic()(undefined, undefined, descriptor);
|
||||
return descriptor.value();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,189 @@
|
||||
import { generic } from "../decorators/eacnet.js";
|
||||
import { Context } from "../types.js";
|
||||
import config from "../utils/config.js";
|
||||
import { Serializable, v } from "../utils/kxml-value.js";
|
||||
import { tokenToCardNumber, tokenToHash, tokenToSnsId } from "../utils/laochan-id.js";
|
||||
|
||||
export class EacGeneric {
|
||||
@generic()
|
||||
async getGoodsList(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
goods_num: v.s32(0),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@generic()
|
||||
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)),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@generic()
|
||||
async getSubscriptionStatus(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
subscription: {
|
||||
name: v.str([
|
||||
'eac_ddr_basic',
|
||||
'EAC_POPNLIVELY',
|
||||
'eac_sdvx_basic',
|
||||
'eacgitadora_basic'
|
||||
]),
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@generic()
|
||||
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),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@generic()
|
||||
async checkVersion(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
permission: v.s32(1),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@generic()
|
||||
async getServerClock(): Promise<Serializable> {
|
||||
return {
|
||||
status: v.s32(0),
|
||||
error_code: v.s32(0),
|
||||
response: {
|
||||
server_clock: v.u64(new Date().valueOf()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@generic()
|
||||
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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@generic()
|
||||
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,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'),
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+20490
File diff suppressed because it is too large
Load Diff
+2
-7782
File diff suppressed because it is too large
Load Diff
@@ -21,4 +21,4 @@ export function eacnet(protocol_name: string, topName: string, dataOffset: numbe
|
||||
}
|
||||
|
||||
export const p2d = eacnet('P2D:2015091800', 'p2d', 0x2E);
|
||||
export const sdvx = eacnet('2020090800', 'eacnet', 0x2A);
|
||||
export const generic = eacnet('2020090800', 'eacnet', 0x2A);
|
||||
|
||||
+13
-2
@@ -126,11 +126,22 @@ async function main(): Promise<void> {
|
||||
|
||||
let method = ctx.service.method;
|
||||
|
||||
if (!service || !(service[method])?.bind) {
|
||||
ctx.logger.warn(`unimplemented method.`);
|
||||
if (!service) {
|
||||
ctx.logger.warn(`unimplemented service ${ctx.service.name}.`);
|
||||
|
||||
service = container.resolve(DefaultService);
|
||||
method = 'default';
|
||||
} else {
|
||||
if (!(service[method])?.bind) {
|
||||
method = ctx.service.module + '_' + ctx.service.method;
|
||||
|
||||
if (!(service[method])?.bind) {
|
||||
ctx.logger.warn(`unimplemented method ${JSON.stringify(ctx.service)}.`);
|
||||
|
||||
service = container.resolve(DefaultService);
|
||||
method = 'default';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctx.body = await (service[method] as Function).bind(service)(ctx);
|
||||
|
||||
@@ -40,6 +40,7 @@ export async function eacnet(ctx: Context, next: Next): Promise<any> {
|
||||
|
||||
ctx.service = {
|
||||
name: info.game_id,
|
||||
module: info.module,
|
||||
method: request.method,
|
||||
};
|
||||
|
||||
@@ -59,6 +60,7 @@ export async function eacnet(ctx: Context, next: Next): Promise<any> {
|
||||
|
||||
ctx.service = {
|
||||
name: game,
|
||||
module: 'p2d',
|
||||
method: result[game].method,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface ILaochanContext {
|
||||
|
||||
service: {
|
||||
name: string,
|
||||
module: string,
|
||||
method: string,
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
export interface PlayerPlayData {
|
||||
_id: string;
|
||||
name: string;
|
||||
bestClearLevel: number;
|
||||
singleGrade: number;
|
||||
doubleGrade: number;
|
||||
leagueClass: number;
|
||||
records: string[];
|
||||
}
|
||||
|
||||
export interface PlayerMusicData {
|
||||
player: string;
|
||||
mcode: number;
|
||||
notes: string[];
|
||||
}
|
||||
Reference in New Issue
Block a user