mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-04-26 02:02:29 -05:00
Initial Release for Gitadora Extension
* Converted from Asphyxia-Public-Route * Enable `resolveJsonModule` in `tsconfig.json` * WebUI for change name and title.
This commit is contained in:
parent
ece1f7b7b8
commit
43e0716b85
15
gitadora@asphyxia/README.md
Normal file
15
gitadora@asphyxia/README.md
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
GITADORA Plugin for Asphyxia-Core
|
||||||
|
=================================
|
||||||
|
This plugin is converted from public-exported Asphyxia's Routes.
|
||||||
|
|
||||||
|
Supported Versions
|
||||||
|
==================
|
||||||
|
- Matixx
|
||||||
|
- Exchain
|
||||||
|
|
||||||
|
|
||||||
|
Release Notes
|
||||||
|
=============
|
||||||
|
v1.0.0 (Current)
|
||||||
|
----------------
|
||||||
|
* Initial release for public
|
||||||
1
gitadora@asphyxia/const.ts
Normal file
1
gitadora@asphyxia/const.ts
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export const PLUGIN_VER = 1;
|
||||||
4
gitadora@asphyxia/data/.gitignore
vendored
Normal file
4
gitadora@asphyxia/data/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
mdb_ex.xml
|
||||||
|
mdb_mt.xml
|
||||||
|
mdb_ex.b64
|
||||||
|
mdb_mt.b64
|
||||||
59
gitadora@asphyxia/data/Exchain.ts
Normal file
59
gitadora@asphyxia/data/Exchain.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
import * as path from "path";
|
||||||
|
import { readXML } from './helper';
|
||||||
|
import { music } from "./mdb_ex.json"
|
||||||
|
|
||||||
|
export async function processData() {
|
||||||
|
return {
|
||||||
|
music,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function processRawData() {
|
||||||
|
const data = await readXML(path.resolve(__dirname, './mdb_ex.xml'))
|
||||||
|
const mdb = $(data).elements("mdb.mdb_data");
|
||||||
|
const music: any[] = [];
|
||||||
|
for (const m of mdb) {
|
||||||
|
const d = m.content("xg_diff_list");
|
||||||
|
const contain = m.content("contain_stat");
|
||||||
|
const gf = contain[0];
|
||||||
|
const dm = contain[1];
|
||||||
|
|
||||||
|
if (gf == 0 && dm == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let type = gf;
|
||||||
|
if (gf == 0) {
|
||||||
|
type = dm;
|
||||||
|
}
|
||||||
|
|
||||||
|
music.push({
|
||||||
|
id: K.ITEM('s32', m.number("music_id")),
|
||||||
|
cont_gf: K.ITEM('bool', gf == 0 ? 0 : 1),
|
||||||
|
cont_dm: K.ITEM('bool', dm == 0 ? 0 : 1),
|
||||||
|
is_secret: K.ITEM('bool', 0),
|
||||||
|
is_hot: K.ITEM('bool', type == 2 ? 0 : 1),
|
||||||
|
data_ver: K.ITEM('s32', m.number("data_ver")),
|
||||||
|
diff: K.ARRAY('u16', [
|
||||||
|
d[0],
|
||||||
|
d[1],
|
||||||
|
d[2],
|
||||||
|
d[3],
|
||||||
|
d[4],
|
||||||
|
d[10],
|
||||||
|
d[11],
|
||||||
|
d[12],
|
||||||
|
d[13],
|
||||||
|
d[14],
|
||||||
|
d[5],
|
||||||
|
d[6],
|
||||||
|
d[7],
|
||||||
|
d[8],
|
||||||
|
d[9],
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
music,
|
||||||
|
};
|
||||||
|
}
|
||||||
59
gitadora@asphyxia/data/Matixx.ts
Normal file
59
gitadora@asphyxia/data/Matixx.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
import * as path from "path";
|
||||||
|
import { readXML } from './helper';
|
||||||
|
import { music } from "./mdb_mt.json"
|
||||||
|
|
||||||
|
export async function processData() {
|
||||||
|
return {
|
||||||
|
music,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function processRawData() {
|
||||||
|
const data = await readXML(path.resolve(__dirname, './mdb_mt.xml'))
|
||||||
|
const mdb = $(data).elements("mdb.mdb_data");
|
||||||
|
const music: any[] = [];
|
||||||
|
for (const m of mdb) {
|
||||||
|
const d = m.content("xg_diff_list");
|
||||||
|
const contain = m.content("contain_stat");
|
||||||
|
const gf = contain[0];
|
||||||
|
const dm = contain[1];
|
||||||
|
|
||||||
|
if (gf == 0 && dm == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let type = gf;
|
||||||
|
if (gf == 0) {
|
||||||
|
type = dm;
|
||||||
|
}
|
||||||
|
|
||||||
|
music.push({
|
||||||
|
id: K.ITEM('s32', m.number("music_id")),
|
||||||
|
cont_gf: K.ITEM('bool', gf == 0 ? 0 : 1),
|
||||||
|
cont_dm: K.ITEM('bool', dm == 0 ? 0 : 1),
|
||||||
|
is_secret: K.ITEM('bool', 0),
|
||||||
|
is_hot: K.ITEM('bool', type == 2 ? 0 : 1),
|
||||||
|
data_ver: K.ITEM('s32', m.number("data_ver")),
|
||||||
|
diff: K.ARRAY('u16', [
|
||||||
|
d[0],
|
||||||
|
d[1],
|
||||||
|
d[2],
|
||||||
|
d[3],
|
||||||
|
d[4],
|
||||||
|
d[10],
|
||||||
|
d[11],
|
||||||
|
d[12],
|
||||||
|
d[13],
|
||||||
|
d[14],
|
||||||
|
d[5],
|
||||||
|
d[6],
|
||||||
|
d[7],
|
||||||
|
d[8],
|
||||||
|
d[9],
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
music,
|
||||||
|
};
|
||||||
|
}
|
||||||
5
gitadora@asphyxia/data/helper.ts
Normal file
5
gitadora@asphyxia/data/helper.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
export async function readXML(path: string) {
|
||||||
|
const xml = await IO.ReadFile(path, 'utf-8');
|
||||||
|
const json = U.parseXML(xml, false)
|
||||||
|
return json
|
||||||
|
}
|
||||||
1
gitadora@asphyxia/data/mdb_ex.json
Normal file
1
gitadora@asphyxia/data/mdb_ex.json
Normal file
File diff suppressed because one or more lines are too long
1
gitadora@asphyxia/data/mdb_mt.json
Normal file
1
gitadora@asphyxia/data/mdb_mt.json
Normal file
File diff suppressed because one or more lines are too long
84
gitadora@asphyxia/handlers/MusicList.ts
Normal file
84
gitadora@asphyxia/handlers/MusicList.ts
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
import { getVersion } from "../utils";
|
||||||
|
import { processData as ExchainMusic } from "../data/Exchain"
|
||||||
|
import { processData as MatixxMusic } from "../data/Matixx"
|
||||||
|
import { readXML } from "../data/helper";
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
|
export const playableMusic: EPR = async (info, data, send) => {
|
||||||
|
const version = getVersion(info);
|
||||||
|
|
||||||
|
let musicList: any[] = [];
|
||||||
|
try {
|
||||||
|
if (U.GetConfig("enable_custom_mdb")) {
|
||||||
|
const data = await readXML(path.normalize(U.GetConfig("custom_mdb_path")))
|
||||||
|
const mdb = $(data).elements("mdb.mdb_data");
|
||||||
|
|
||||||
|
for (const m of mdb) {
|
||||||
|
const d = m.content("xg_diff_list");
|
||||||
|
const contain = m.content("contain_stat");
|
||||||
|
const gf = contain[0];
|
||||||
|
const dm = contain[1];
|
||||||
|
|
||||||
|
if (gf == 0 && dm == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let type = gf;
|
||||||
|
if (gf == 0) {
|
||||||
|
type = dm;
|
||||||
|
}
|
||||||
|
|
||||||
|
musicList.push({
|
||||||
|
id: K.ITEM('s32', m.number("music_id")),
|
||||||
|
cont_gf: K.ITEM('bool', gf == 0 ? 0 : 1),
|
||||||
|
cont_dm: K.ITEM('bool', dm == 0 ? 0 : 1),
|
||||||
|
is_secret: K.ITEM('bool', 0),
|
||||||
|
is_hot: K.ITEM('bool', type == 2 ? 0 : 1),
|
||||||
|
data_ver: K.ITEM('s32', m.number("data_ver", 115)),
|
||||||
|
diff: K.ARRAY('u16', [
|
||||||
|
d[0],
|
||||||
|
d[1],
|
||||||
|
d[2],
|
||||||
|
d[3],
|
||||||
|
d[4],
|
||||||
|
d[10],
|
||||||
|
d[11],
|
||||||
|
d[12],
|
||||||
|
d[13],
|
||||||
|
d[14],
|
||||||
|
d[5],
|
||||||
|
d[6],
|
||||||
|
d[7],
|
||||||
|
d[8],
|
||||||
|
d[9],
|
||||||
|
]),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e.stack);
|
||||||
|
send.deny();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (musicList.length == 0) {
|
||||||
|
if (version == 'exchain') {
|
||||||
|
musicList = _.get(await ExchainMusic(), 'music', []);
|
||||||
|
} else {
|
||||||
|
musicList = _.get(await MatixxMusic(), 'music', []);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await send.object({
|
||||||
|
hot: {
|
||||||
|
major: K.ITEM('s32', 1),
|
||||||
|
minor: K.ITEM('s32', 1),
|
||||||
|
},
|
||||||
|
musicinfo: {
|
||||||
|
'@attr': {
|
||||||
|
nr: musicList.length,
|
||||||
|
},
|
||||||
|
'music': musicList,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
143
gitadora@asphyxia/handlers/info.ts
Normal file
143
gitadora@asphyxia/handlers/info.ts
Normal file
|
|
@ -0,0 +1,143 @@
|
||||||
|
export const shopInfoRegist: EPR = async (info, data, send) => {
|
||||||
|
send.object({
|
||||||
|
data: {
|
||||||
|
cabid: K.ITEM('u32', 1),
|
||||||
|
locationid: K.ITEM('str', 'Asphyxia'),
|
||||||
|
},
|
||||||
|
temperature: {
|
||||||
|
is_send: K.ITEM('bool', 0),
|
||||||
|
},
|
||||||
|
tax: {
|
||||||
|
tax_phase: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const gameInfoGet: EPR = async (info, data, send) => {
|
||||||
|
const addition: any = {
|
||||||
|
monstar_subjugation: {
|
||||||
|
bonus_musicid: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
bear_fes: {},
|
||||||
|
};
|
||||||
|
const time = BigInt(31536000);
|
||||||
|
for (let i = 1; i <= 20; ++i) {
|
||||||
|
const obj = {
|
||||||
|
term: K.ITEM('u8', 0),
|
||||||
|
start_date_ms: K.ITEM('u64', time),
|
||||||
|
end_date_ms: K.ITEM('u64', time),
|
||||||
|
};
|
||||||
|
if (i == 1) {
|
||||||
|
addition[`phrase_combo_challenge`] = obj;
|
||||||
|
addition[`long_otobear_fes_1`] = {
|
||||||
|
term: K.ITEM('u8', 0),
|
||||||
|
start_date_ms: K.ITEM('u64', time),
|
||||||
|
end_date_ms: K.ITEM('u64', time),
|
||||||
|
bonus_musicid: {},
|
||||||
|
};
|
||||||
|
addition[`sdvx_stamprally3`] = obj;
|
||||||
|
addition[`chronicle_1`] = obj;
|
||||||
|
addition[`paseli_point_lottery`] = obj;
|
||||||
|
addition['sticker_campaign'] = {
|
||||||
|
term: K.ITEM('u8', 0),
|
||||||
|
sticker_list: {},
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
addition[`phrase_combo_challenge_${i}`] = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i <= 4) {
|
||||||
|
addition['monstar_subjugation'][`monstar_subjugation_${i}`] = obj;
|
||||||
|
addition['bear_fes'][`bear_fes_${i}`] = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i <= 3) {
|
||||||
|
addition[`kouyou_challenge_${i}`] = {
|
||||||
|
term: K.ITEM('u8', 0),
|
||||||
|
bonus_musicid: K.ITEM('s32', 0),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await send.object({
|
||||||
|
now_date: K.ITEM('u64', time),
|
||||||
|
extra: {
|
||||||
|
extra_lv: K.ITEM('u8', 10),
|
||||||
|
extramusic: {
|
||||||
|
music: {
|
||||||
|
musicid: K.ITEM('s32', 0),
|
||||||
|
get_border: K.ITEM('u8', 0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
infect_music: { term: K.ITEM('u8', 0) },
|
||||||
|
unlock_challenge: { term: K.ITEM('u8', 0) },
|
||||||
|
battle: { term: K.ITEM('u8', 0) },
|
||||||
|
battle_chara: { term: K.ITEM('u8', 0) },
|
||||||
|
data_ver_limit: { term: K.ITEM('u8', 0) },
|
||||||
|
ea_pass_propel: { term: K.ITEM('u8', 0) },
|
||||||
|
monthly_skill: {
|
||||||
|
term: K.ITEM('u8', 0),
|
||||||
|
target_music: {
|
||||||
|
music: {
|
||||||
|
musicid: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
update_prog: { term: K.ITEM('u8', 0) },
|
||||||
|
rockwave: { event_list: {} },
|
||||||
|
general_term: {},
|
||||||
|
jubeat_omiyage_challenge: {},
|
||||||
|
kac2017: {},
|
||||||
|
nostalgia_concert: {},
|
||||||
|
trbitemdata: {},
|
||||||
|
ctrl_movie: {},
|
||||||
|
ng_jacket: {},
|
||||||
|
ng_recommend_music: {},
|
||||||
|
ranking: {
|
||||||
|
skill_0_999: {},
|
||||||
|
skill_1000_1499: {},
|
||||||
|
skill_1500_1999: {},
|
||||||
|
skill_2000_2499: {},
|
||||||
|
skill_2500_2999: {},
|
||||||
|
skill_3000_3499: {},
|
||||||
|
skill_3500_3999: {},
|
||||||
|
skill_4000_4499: {},
|
||||||
|
skill_4500_4999: {},
|
||||||
|
skill_5000_5499: {},
|
||||||
|
skill_5500_5999: {},
|
||||||
|
skill_6000_6499: {},
|
||||||
|
skill_6500_6999: {},
|
||||||
|
skill_7000_7499: {},
|
||||||
|
skill_7500_7999: {},
|
||||||
|
skill_8000_8499: {},
|
||||||
|
skill_8500_9999: {},
|
||||||
|
total: {},
|
||||||
|
original: {},
|
||||||
|
bemani: {},
|
||||||
|
famous: {},
|
||||||
|
anime: {},
|
||||||
|
band: {},
|
||||||
|
western: {},
|
||||||
|
},
|
||||||
|
processing_report_state: K.ITEM('u8', 0),
|
||||||
|
assert_report_state: K.ITEM('u8', 0),
|
||||||
|
recommendmusic: { '@attr': { nr: 0 } },
|
||||||
|
demomusic: { '@attr': { nr: 0 } },
|
||||||
|
event_skill: {},
|
||||||
|
temperature: { is_send: K.ITEM('bool', 0) },
|
||||||
|
bemani_summer_2018: { is_open: K.ITEM('bool', 0) },
|
||||||
|
kac2018: {
|
||||||
|
event: {
|
||||||
|
term: K.ITEM('s32', 0),
|
||||||
|
since: K.ITEM('u64', BigInt(0)),
|
||||||
|
till: K.ITEM('u64', BigInt(0)),
|
||||||
|
is_open: K.ITEM('bool', 0),
|
||||||
|
target_music: {
|
||||||
|
music_id: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
...addition,
|
||||||
|
});
|
||||||
|
};
|
||||||
976
gitadora@asphyxia/handlers/profiles.ts
Normal file
976
gitadora@asphyxia/handlers/profiles.ts
Normal file
|
|
@ -0,0 +1,976 @@
|
||||||
|
import { PlayerInfo } from "../models/playerinfo";
|
||||||
|
import { Profile } from "../models/profile";
|
||||||
|
import { Record } from "../models/record";
|
||||||
|
import { Extra } from "../models/extra";
|
||||||
|
import { getVersion, isDM } from "../utils";
|
||||||
|
import { Scores } from "../models/scores";
|
||||||
|
import { PLUGIN_VER } from "../const";
|
||||||
|
|
||||||
|
export const regist: EPR = async (info, data, send) => {
|
||||||
|
const refid = $(data).str('player.refid');
|
||||||
|
if (!refid) return send.deny();
|
||||||
|
|
||||||
|
const no = getPlayerNo(data);
|
||||||
|
const version = getVersion(info);
|
||||||
|
|
||||||
|
const playerInfo = await DB.FindOne<PlayerInfo>(refid, {
|
||||||
|
collection: 'playerinfo',
|
||||||
|
version
|
||||||
|
})
|
||||||
|
|
||||||
|
if (playerInfo) {
|
||||||
|
send.object({
|
||||||
|
player: K.ATTR({ no: `${no}` }, {
|
||||||
|
is_succession: K.ITEM("bool", 0), //FIX THIS with upsert result.
|
||||||
|
did: K.ITEM("s32", playerInfo.id)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let info = await registerUser(refid, version)
|
||||||
|
send.object({
|
||||||
|
player: K.ATTR({ no: `${no}` }, {
|
||||||
|
is_succession: K.ITEM("bool", 0), //FIX THIS with upsert result.
|
||||||
|
did: K.ITEM("s32", info.id)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const check: EPR = async (info, data, send) => {
|
||||||
|
const refid = $(data).str('player.refid');
|
||||||
|
if (!refid) return send.deny();
|
||||||
|
|
||||||
|
const no = getPlayerNo(data);
|
||||||
|
const version = getVersion(info)
|
||||||
|
|
||||||
|
const playerInfo = await DB.FindOne<PlayerInfo>(refid, {
|
||||||
|
collection: 'playerinfo',
|
||||||
|
})
|
||||||
|
|
||||||
|
if (playerInfo) {
|
||||||
|
send.object({
|
||||||
|
player: K.ATTR({ no: `${no}`, state: '2' }, {
|
||||||
|
name: K.ITEM('str', playerInfo.name),
|
||||||
|
charaid: K.ITEM('s32', 0),
|
||||||
|
did: K.ITEM('s32', playerInfo.id),
|
||||||
|
skilldata: {
|
||||||
|
skill: K.ITEM('s32', 0),
|
||||||
|
all_skill: K.ITEM('s32', 0),
|
||||||
|
old_skill: K.ITEM('s32', 0),
|
||||||
|
old_all_skill: K.ITEM('s32', 0),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
let info = await registerUser(refid, version)
|
||||||
|
send.object({
|
||||||
|
player: K.ATTR({ no: `${no}`, state: '2' }, {
|
||||||
|
name: K.ITEM('str', info.name),
|
||||||
|
charaid: K.ITEM('s32', 0),
|
||||||
|
did: K.ITEM('s32', info.id),
|
||||||
|
skilldata: {
|
||||||
|
skill: K.ITEM('s32', 0),
|
||||||
|
all_skill: K.ITEM('s32', 0),
|
||||||
|
old_skill: K.ITEM('s32', 0),
|
||||||
|
old_all_skill: K.ITEM('s32', 0),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getPlayer: EPR = async (info, data, send) => {
|
||||||
|
const refid = $(data).str('player.refid');
|
||||||
|
if (!refid) return send.deny();
|
||||||
|
|
||||||
|
const no = getPlayerNo(data);
|
||||||
|
const version = getVersion(info);
|
||||||
|
const time = BigInt(31536000);
|
||||||
|
const dm = isDM(info);
|
||||||
|
|
||||||
|
const name = await DB.FindOne<PlayerInfo>(refid, {
|
||||||
|
collection: 'playerinfo',
|
||||||
|
})
|
||||||
|
const dmProfile = await getProfile(refid, version, 'dm')
|
||||||
|
const gfProfile = await getProfile(refid, version, 'gf')
|
||||||
|
const dmRecord = await getRecord(refid, version, 'dm')
|
||||||
|
const gfRecord = await getRecord(refid, version, 'gf')
|
||||||
|
const dmExtra = await getExtra(refid, version, 'dm')
|
||||||
|
const gfExtra = await getExtra(refid, version, 'gf')
|
||||||
|
const dmScores = await getScores(refid, version, 'dm')
|
||||||
|
const gfScores = await getScores(refid, version, 'gf')
|
||||||
|
|
||||||
|
const profile = dm ? dmProfile : gfProfile;
|
||||||
|
const extra = dm ? dmExtra : gfExtra;
|
||||||
|
|
||||||
|
const record: any = {
|
||||||
|
gf: {},
|
||||||
|
dm: {},
|
||||||
|
};
|
||||||
|
for (const mode of ['dm', 'gf']) {
|
||||||
|
let game = mode == 'gf' ? gfProfile : dmProfile;
|
||||||
|
let rec = mode == 'gf' ? gfRecord : dmRecord;
|
||||||
|
record[mode] = {
|
||||||
|
max_record: {
|
||||||
|
skill: K.ITEM('s32', game.max_skill),
|
||||||
|
all_skill: K.ITEM('s32', game.max_all_skill),
|
||||||
|
clear_diff: K.ITEM('s32', game.clear_diff),
|
||||||
|
full_diff: K.ITEM('s32', game.full_diff),
|
||||||
|
exce_diff: K.ITEM('s32', game.exce_diff),
|
||||||
|
clear_music_num: K.ITEM('s32', game.clear_music_num),
|
||||||
|
full_music_num: K.ITEM('s32', game.full_music_num),
|
||||||
|
exce_music_num: K.ITEM('s32', game.exce_music_num),
|
||||||
|
clear_seq_num: K.ITEM('s32', game.clear_seq_num),
|
||||||
|
classic_all_skill: K.ITEM('s32', game.classic_all_skill),
|
||||||
|
},
|
||||||
|
diff_record: {
|
||||||
|
diff_100_nr: K.ITEM('s32', rec.diff_100_nr),
|
||||||
|
diff_150_nr: K.ITEM('s32', rec.diff_150_nr),
|
||||||
|
diff_200_nr: K.ITEM('s32', rec.diff_200_nr),
|
||||||
|
diff_250_nr: K.ITEM('s32', rec.diff_250_nr),
|
||||||
|
diff_300_nr: K.ITEM('s32', rec.diff_300_nr),
|
||||||
|
diff_350_nr: K.ITEM('s32', rec.diff_350_nr),
|
||||||
|
diff_400_nr: K.ITEM('s32', rec.diff_400_nr),
|
||||||
|
diff_450_nr: K.ITEM('s32', rec.diff_450_nr),
|
||||||
|
diff_500_nr: K.ITEM('s32', rec.diff_500_nr),
|
||||||
|
diff_550_nr: K.ITEM('s32', rec.diff_550_nr),
|
||||||
|
diff_600_nr: K.ITEM('s32', rec.diff_600_nr),
|
||||||
|
diff_650_nr: K.ITEM('s32', rec.diff_650_nr),
|
||||||
|
diff_700_nr: K.ITEM('s32', rec.diff_700_nr),
|
||||||
|
diff_750_nr: K.ITEM('s32', rec.diff_750_nr),
|
||||||
|
diff_800_nr: K.ITEM('s32', rec.diff_800_nr),
|
||||||
|
diff_850_nr: K.ITEM('s32', rec.diff_850_nr),
|
||||||
|
diff_900_nr: K.ITEM('s32', rec.diff_900_nr),
|
||||||
|
diff_950_nr: K.ITEM('s32', rec.diff_950_nr),
|
||||||
|
diff_100_clear: K.ARRAY('s32', rec.diff_100_clear),
|
||||||
|
diff_150_clear: K.ARRAY('s32', rec.diff_150_clear),
|
||||||
|
diff_200_clear: K.ARRAY('s32', rec.diff_200_clear),
|
||||||
|
diff_250_clear: K.ARRAY('s32', rec.diff_250_clear),
|
||||||
|
diff_300_clear: K.ARRAY('s32', rec.diff_300_clear),
|
||||||
|
diff_350_clear: K.ARRAY('s32', rec.diff_350_clear),
|
||||||
|
diff_400_clear: K.ARRAY('s32', rec.diff_400_clear),
|
||||||
|
diff_450_clear: K.ARRAY('s32', rec.diff_450_clear),
|
||||||
|
diff_500_clear: K.ARRAY('s32', rec.diff_500_clear),
|
||||||
|
diff_550_clear: K.ARRAY('s32', rec.diff_550_clear),
|
||||||
|
diff_600_clear: K.ARRAY('s32', rec.diff_600_clear),
|
||||||
|
diff_650_clear: K.ARRAY('s32', rec.diff_650_clear),
|
||||||
|
diff_700_clear: K.ARRAY('s32', rec.diff_700_clear),
|
||||||
|
diff_750_clear: K.ARRAY('s32', rec.diff_750_clear),
|
||||||
|
diff_800_clear: K.ARRAY('s32', rec.diff_800_clear),
|
||||||
|
diff_850_clear: K.ARRAY('s32', rec.diff_850_clear),
|
||||||
|
diff_900_clear: K.ARRAY('s32', rec.diff_900_clear),
|
||||||
|
diff_950_clear: K.ARRAY('s32', rec.diff_950_clear),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format scores
|
||||||
|
const musicdata = [];
|
||||||
|
const scores = dm ? dmScores : gfScores;
|
||||||
|
for (const score of scores) {
|
||||||
|
const mid = score.mid
|
||||||
|
musicdata.push(K.ATTR({ musicid: `${mid}` }, {
|
||||||
|
mdata: K.ARRAY('s16', [
|
||||||
|
-1,
|
||||||
|
_.get(score, 'diffs.1.perc', -2),
|
||||||
|
_.get(score, 'diffs.2.perc', -2),
|
||||||
|
_.get(score, 'diffs.3.perc', -2),
|
||||||
|
_.get(score, 'diffs.4.perc', -2),
|
||||||
|
_.get(score, 'diffs.5.perc', -2),
|
||||||
|
_.get(score, 'diffs.6.perc', -2),
|
||||||
|
_.get(score, 'diffs.7.perc', -2),
|
||||||
|
_.get(score, 'diffs.8.perc', -2),
|
||||||
|
_.get(score, 'diffs.1.rank', 0),
|
||||||
|
_.get(score, 'diffs.2.rank', 0),
|
||||||
|
_.get(score, 'diffs.3.rank', 0),
|
||||||
|
_.get(score, 'diffs.4.rank', 0),
|
||||||
|
_.get(score, 'diffs.5.rank', 0),
|
||||||
|
_.get(score, 'diffs.6.rank', 0),
|
||||||
|
_.get(score, 'diffs.7.rank', 0),
|
||||||
|
_.get(score, 'diffs.8.rank', 0),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
]),
|
||||||
|
flag: K.ARRAY('u16', [
|
||||||
|
_.get(score, 'diffs.1.fc', false) * 2 +
|
||||||
|
_.get(score, 'diffs.2.fc', false) * 4 +
|
||||||
|
_.get(score, 'diffs.3.fc', false) * 8 +
|
||||||
|
_.get(score, 'diffs.4.fc', false) * 16 +
|
||||||
|
_.get(score, 'diffs.5.fc', false) * 32 +
|
||||||
|
_.get(score, 'diffs.6.fc', false) * 64 +
|
||||||
|
_.get(score, 'diffs.7.fc', false) * 128 +
|
||||||
|
_.get(score, 'diffs.8.fc', false) * 256,
|
||||||
|
_.get(score, 'diffs.1.ex', false) * 2 +
|
||||||
|
_.get(score, 'diffs.2.ex', false) * 4 +
|
||||||
|
_.get(score, 'diffs.3.ex', false) * 8 +
|
||||||
|
_.get(score, 'diffs.4.ex', false) * 16 +
|
||||||
|
_.get(score, 'diffs.5.ex', false) * 32 +
|
||||||
|
_.get(score, 'diffs.6.ex', false) * 64 +
|
||||||
|
_.get(score, 'diffs.7.ex', false) * 128 +
|
||||||
|
_.get(score, 'diffs.8.ex', false) * 256,
|
||||||
|
_.get(score, 'diffs.1.clear', false) * 2 +
|
||||||
|
_.get(score, 'diffs.2.clear', false) * 4 +
|
||||||
|
_.get(score, 'diffs.3.clear', false) * 8 +
|
||||||
|
_.get(score, 'diffs.4.clear', false) * 16 +
|
||||||
|
_.get(score, 'diffs.5.clear', false) * 32 +
|
||||||
|
_.get(score, 'diffs.6.clear', false) * 64 +
|
||||||
|
_.get(score, 'diffs.7.clear', false) * 128 +
|
||||||
|
_.get(score, 'diffs.8.clear', false) * 256,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
]),
|
||||||
|
sdata: K.ARRAY('s16', score.update),
|
||||||
|
meter: K.ARRAY('u64', [
|
||||||
|
BigInt(_.get(score, 'diffs.1.meter', '0')),
|
||||||
|
BigInt(_.get(score, 'diffs.2.meter', '0')),
|
||||||
|
BigInt(_.get(score, 'diffs.3.meter', '0')),
|
||||||
|
BigInt(_.get(score, 'diffs.4.meter', '0')),
|
||||||
|
BigInt(_.get(score, 'diffs.5.meter', '0')),
|
||||||
|
BigInt(_.get(score, 'diffs.6.meter', '0')),
|
||||||
|
BigInt(_.get(score, 'diffs.7.meter', '0')),
|
||||||
|
BigInt(_.get(score, 'diffs.8.meter', '0')),
|
||||||
|
]),
|
||||||
|
meter_prog: K.ARRAY('s16', [
|
||||||
|
_.get(score, 'diffs.1.prog', 0),
|
||||||
|
_.get(score, 'diffs.2.prog', 0),
|
||||||
|
_.get(score, 'diffs.3.prog', 0),
|
||||||
|
_.get(score, 'diffs.4.prog', 0),
|
||||||
|
_.get(score, 'diffs.5.prog', 0),
|
||||||
|
_.get(score, 'diffs.6.prog', 0),
|
||||||
|
_.get(score, 'diffs.7.prog', 0),
|
||||||
|
_.get(score, 'diffs.8.prog', 0),
|
||||||
|
]),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
const sticker: any[] = [];
|
||||||
|
|
||||||
|
if (_.isArray(name.card)) {
|
||||||
|
for (const item of name.card) {
|
||||||
|
const id = _.get(item, 'id');
|
||||||
|
const posX = _.get(item, 'position.0');
|
||||||
|
const posY = _.get(item, 'position.1');
|
||||||
|
const scaleX = _.get(item, 'scale.0');
|
||||||
|
const scaleY = _.get(item, 'scale.1');
|
||||||
|
const rotation = _.get(item, 'rotation');
|
||||||
|
|
||||||
|
if (
|
||||||
|
!isFinite(id) ||
|
||||||
|
!isFinite(posX) ||
|
||||||
|
!isFinite(posY) ||
|
||||||
|
!isFinite(scaleX) ||
|
||||||
|
!isFinite(scaleY) ||
|
||||||
|
!isFinite(rotation)
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sticker.push({
|
||||||
|
id: K.ITEM('s32', id),
|
||||||
|
pos_x: K.ITEM('float', posX),
|
||||||
|
pos_y: K.ITEM('float', posY),
|
||||||
|
scale_x: K.ITEM('float', scaleX),
|
||||||
|
scale_y: K.ITEM('float', scaleY),
|
||||||
|
rotate: K.ITEM('float', rotation),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const playerData: any = {
|
||||||
|
playerboard: {
|
||||||
|
index: K.ITEM('s32', 1),
|
||||||
|
is_active: K.ITEM('bool', _.isArray(name.card) ? 1 : 0),
|
||||||
|
sticker,
|
||||||
|
},
|
||||||
|
player_info: {
|
||||||
|
player_type: K.ITEM('s8', 0),
|
||||||
|
did: K.ITEM('s32', 13376666),
|
||||||
|
name: K.ITEM('str', name.name),
|
||||||
|
title: K.ITEM('str', name.title),
|
||||||
|
charaid: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
customdata: {
|
||||||
|
playstyle: K.ARRAY('s32', extra.playstyle),
|
||||||
|
custom: K.ARRAY('s32', extra.custom),
|
||||||
|
},
|
||||||
|
playinfo: {
|
||||||
|
cabid: K.ITEM('s32', 0),
|
||||||
|
play: K.ITEM('s32', profile.play),
|
||||||
|
playtime: K.ITEM('s32', profile.playtime),
|
||||||
|
playterm: K.ITEM('s32', profile.playterm),
|
||||||
|
session_cnt: K.ITEM('s32', profile.session_cnt),
|
||||||
|
matching_num: K.ITEM('s32', 0),
|
||||||
|
extra_stage: K.ITEM('s32', profile.extra_stage),
|
||||||
|
extra_play: K.ITEM('s32', profile.extra_play),
|
||||||
|
extra_clear: K.ITEM('s32', profile.extra_clear),
|
||||||
|
encore_play: K.ITEM('s32', profile.encore_play),
|
||||||
|
encore_clear: K.ITEM('s32', profile.encore_clear),
|
||||||
|
pencore_play: K.ITEM('s32', profile.pencore_play),
|
||||||
|
pencore_clear: K.ITEM('s32', profile.pencore_clear),
|
||||||
|
max_clear_diff: K.ITEM('s32', profile.max_clear_diff),
|
||||||
|
max_full_diff: K.ITEM('s32', profile.max_full_diff),
|
||||||
|
max_exce_diff: K.ITEM('s32', profile.max_exce_diff),
|
||||||
|
clear_num: K.ITEM('s32', profile.clear_num),
|
||||||
|
full_num: K.ITEM('s32', profile.full_num),
|
||||||
|
exce_num: K.ITEM('s32', profile.exce_num),
|
||||||
|
no_num: K.ITEM('s32', profile.no_num),
|
||||||
|
e_num: K.ITEM('s32', profile.e_num),
|
||||||
|
d_num: K.ITEM('s32', profile.d_num),
|
||||||
|
c_num: K.ITEM('s32', profile.c_num),
|
||||||
|
b_num: K.ITEM('s32', profile.b_num),
|
||||||
|
a_num: K.ITEM('s32', profile.a_num),
|
||||||
|
s_num: K.ITEM('s32', profile.s_num),
|
||||||
|
ss_num: K.ITEM('s32', profile.ss_num),
|
||||||
|
last_category: K.ITEM('s32', profile.last_category),
|
||||||
|
last_musicid: K.ITEM('s32', profile.last_musicid),
|
||||||
|
last_seq: K.ITEM('s32', profile.last_seq),
|
||||||
|
disp_level: K.ITEM('s32', profile.disp_level),
|
||||||
|
},
|
||||||
|
tutorial: {
|
||||||
|
progress: K.ITEM('s32', profile.progress),
|
||||||
|
disp_state: K.ITEM('u32', profile.disp_state),
|
||||||
|
},
|
||||||
|
skilldata: {
|
||||||
|
skill: K.ITEM('s32', profile.skill),
|
||||||
|
all_skill: K.ITEM('s32', profile.all_skill),
|
||||||
|
old_skill: K.ITEM('s32', 0),
|
||||||
|
old_all_skill: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
favoritemusic: {
|
||||||
|
list_1: K.ARRAY('s32', extra.list_1),
|
||||||
|
list_2: K.ARRAY('s32', extra.list_2),
|
||||||
|
list_3: K.ARRAY('s32', extra.list_3),
|
||||||
|
},
|
||||||
|
record,
|
||||||
|
groove: {
|
||||||
|
extra_gauge: K.ITEM('s32', profile.extra_gauge),
|
||||||
|
encore_gauge: K.ITEM('s32', profile.encore_gauge),
|
||||||
|
encore_cnt: K.ITEM('s32', profile.encore_cnt),
|
||||||
|
encore_success: K.ITEM('s32', profile.encore_success),
|
||||||
|
unlock_point: K.ITEM('s32', profile.unlock_point),
|
||||||
|
},
|
||||||
|
musiclist: { '@attr': { nr: musicdata.length }, musicdata },
|
||||||
|
};
|
||||||
|
|
||||||
|
const addition: any = {
|
||||||
|
monstar_subjugation: {},
|
||||||
|
bear_fes: {},
|
||||||
|
};
|
||||||
|
for (let i = 1; i <= 20; ++i) {
|
||||||
|
const obj = { point: K.ITEM('s32', 0) };
|
||||||
|
if (i == 1) {
|
||||||
|
addition['long_otobear_fes_1'] = obj;
|
||||||
|
addition['phrase_combo_challenge'] = obj;
|
||||||
|
addition['sdvx_stamprally3'] = obj;
|
||||||
|
addition['chronicle_1'] = obj;
|
||||||
|
} else {
|
||||||
|
addition[`phrase_combo_challenge_${i}`] = obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i <= 4) {
|
||||||
|
addition.bear_fes[`bear_fes_${i}`] = {
|
||||||
|
stage: K.ITEM('s32', 0),
|
||||||
|
point: K.ARRAY('s32', [0, 0, 0, 0, 0, 0, 0, 0]),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i <= 3) {
|
||||||
|
addition.monstar_subjugation[`monstar_subjugation_${i}`] = {
|
||||||
|
stage: K.ITEM('s32', 0),
|
||||||
|
point_1: K.ITEM('s32', 0),
|
||||||
|
point_2: K.ITEM('s32', 0),
|
||||||
|
point_3: K.ITEM('s32', 0),
|
||||||
|
};
|
||||||
|
addition[`kouyou_challenge_${i}`] = { point: K.ITEM('s32', 0) };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
send.object({
|
||||||
|
player: K.ATTR({ 'no': `$no` }, {
|
||||||
|
now_date: K.ITEM('u64', time),
|
||||||
|
secretmusic: {
|
||||||
|
music: {
|
||||||
|
musicid: K.ITEM('s32', 0),
|
||||||
|
seq: K.ITEM('u16', 255),
|
||||||
|
kind: K.ITEM('s32', 40),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
chara_list: {},
|
||||||
|
title_parts: {},
|
||||||
|
information: {
|
||||||
|
info: K.ARRAY('u32', Array(50).fill(0)),
|
||||||
|
},
|
||||||
|
reward: {
|
||||||
|
status: K.ARRAY('u32', Array(50).fill(0)),
|
||||||
|
},
|
||||||
|
rivaldata: {},
|
||||||
|
frienddata: {},
|
||||||
|
thanks_medal: {
|
||||||
|
medal: K.ITEM('s32', 0),
|
||||||
|
grant_medal: K.ITEM('s32', 0),
|
||||||
|
grant_total_medal: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
recommend_musicid_list: K.ARRAY('s32', [0, 0, 0, 0, 0]),
|
||||||
|
skindata: {
|
||||||
|
skin: K.ARRAY('u32', Array(100).fill(-1)),
|
||||||
|
},
|
||||||
|
battledata: {
|
||||||
|
info: {
|
||||||
|
orb: K.ITEM('s32', 0),
|
||||||
|
get_gb_point: K.ITEM('s32', 0),
|
||||||
|
send_gb_point: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
greeting: {
|
||||||
|
greeting_1: K.ITEM('str', ''),
|
||||||
|
greeting_2: K.ITEM('str', ''),
|
||||||
|
greeting_3: K.ITEM('str', ''),
|
||||||
|
greeting_4: K.ITEM('str', ''),
|
||||||
|
greeting_5: K.ITEM('str', ''),
|
||||||
|
greeting_6: K.ITEM('str', ''),
|
||||||
|
greeting_7: K.ITEM('str', ''),
|
||||||
|
greeting_8: K.ITEM('str', ''),
|
||||||
|
greeting_9: K.ITEM('str', ''),
|
||||||
|
},
|
||||||
|
setting: {
|
||||||
|
matching: K.ITEM('s32', 0),
|
||||||
|
info_level: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
score: {
|
||||||
|
battle_class: K.ITEM('s32', 0),
|
||||||
|
max_battle_class: K.ITEM('s32', 0),
|
||||||
|
battle_point: K.ITEM('s32', 0),
|
||||||
|
win: K.ITEM('s32', 0),
|
||||||
|
lose: K.ITEM('s32', 0),
|
||||||
|
draw: K.ITEM('s32', 0),
|
||||||
|
consecutive_win: K.ITEM('s32', 0),
|
||||||
|
max_consecutive_win: K.ITEM('s32', 0),
|
||||||
|
glorious_win: K.ITEM('s32', 0),
|
||||||
|
max_defeat_skill: K.ITEM('s32', 0),
|
||||||
|
latest_result: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
history: {},
|
||||||
|
},
|
||||||
|
is_free_ok: K.ITEM('bool', 0),
|
||||||
|
ranking: {
|
||||||
|
skill: { rank: K.ITEM('s32', 1), total_nr: K.ITEM('s32', 1) },
|
||||||
|
all_skill: { rank: K.ITEM('s32', 1), total_nr: K.ITEM('s32', 1) },
|
||||||
|
},
|
||||||
|
stage_result: {},
|
||||||
|
monthly_skill: {},
|
||||||
|
event_skill: {
|
||||||
|
skill: K.ITEM('s32', 0),
|
||||||
|
ranking: {
|
||||||
|
rank: K.ITEM('s32', 0),
|
||||||
|
total_nr: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
eventlist: {},
|
||||||
|
},
|
||||||
|
event_score: { eventlist: {} },
|
||||||
|
rockwave: { score_list: {} },
|
||||||
|
jubeat_omiyage_challenge: {},
|
||||||
|
light_mode_reward_item: { itemid: K.ITEM('s32', -1), rarity: K.ITEM('s32', 0) },
|
||||||
|
standard_mode_reward_item: { itemid: K.ITEM('s32', -1), rarity: K.ITEM('s32', 0) },
|
||||||
|
delux_mode_reward_item: { itemid: K.ITEM('s32', -1), rarity: K.ITEM('s32', 0) },
|
||||||
|
kac2018: {
|
||||||
|
entry_status: K.ITEM('s32', 0),
|
||||||
|
data: {
|
||||||
|
term: K.ITEM('s32', 0),
|
||||||
|
total_score: K.ITEM('s32', 0),
|
||||||
|
score: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||||
|
music_type: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||||
|
play_count: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sticker_campaign: {},
|
||||||
|
kac2017: {
|
||||||
|
entry_status: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
nostalgia_concert: {},
|
||||||
|
bemani_summer_2018: {
|
||||||
|
linkage_id: K.ITEM('s32', -1),
|
||||||
|
is_entry: K.ITEM('bool', 0),
|
||||||
|
target_music_idx: K.ITEM('s32', -1),
|
||||||
|
point_1: K.ITEM('s32', 0),
|
||||||
|
point_2: K.ITEM('s32', 0),
|
||||||
|
point_3: K.ITEM('s32', 0),
|
||||||
|
point_4: K.ITEM('s32', 0),
|
||||||
|
point_5: K.ITEM('s32', 0),
|
||||||
|
point_6: K.ITEM('s32', 0),
|
||||||
|
point_7: K.ITEM('s32', 0),
|
||||||
|
reward_1: K.ITEM('bool', 0),
|
||||||
|
reward_2: K.ITEM('bool', 0),
|
||||||
|
reward_3: K.ITEM('bool', 0),
|
||||||
|
reward_4: K.ITEM('bool', 0),
|
||||||
|
reward_5: K.ITEM('bool', 0),
|
||||||
|
reward_6: K.ITEM('bool', 0),
|
||||||
|
reward_7: K.ITEM('bool', 0),
|
||||||
|
unlock_status_1: K.ITEM('s32', 0),
|
||||||
|
unlock_status_2: K.ITEM('s32', 0),
|
||||||
|
unlock_status_3: K.ITEM('s32', 0),
|
||||||
|
unlock_status_4: K.ITEM('s32', 0),
|
||||||
|
unlock_status_5: K.ITEM('s32', 0),
|
||||||
|
unlock_status_6: K.ITEM('s32', 0),
|
||||||
|
unlock_status_7: K.ITEM('s32', 0),
|
||||||
|
},
|
||||||
|
...addition,
|
||||||
|
...playerData,
|
||||||
|
finish: K.ITEM('bool', 1),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPlayerNo(data: any): number {
|
||||||
|
return parseInt($(data).attr("player").no || '1', 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function registerUser(refid: string, version: string, id = _.random(0, 99999999)) {
|
||||||
|
while (await DB.FindOne<PlayerInfo>(null, { collecttion: 'profile', id })) {
|
||||||
|
id = _.random(0, 99999999);
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultInfo: PlayerInfo = {
|
||||||
|
collection: 'playerinfo',
|
||||||
|
pluginVer: PLUGIN_VER,
|
||||||
|
id,
|
||||||
|
version,
|
||||||
|
name: 'ASPHYXIA-CORE USER',
|
||||||
|
title: 'Please edit on WebUI',
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultProfile = (dm): Profile => {
|
||||||
|
return {
|
||||||
|
collection: 'profile',
|
||||||
|
pluginVer: PLUGIN_VER,
|
||||||
|
|
||||||
|
game: dm ? 'dm' : 'gf',
|
||||||
|
version,
|
||||||
|
id,
|
||||||
|
|
||||||
|
play: 0,
|
||||||
|
playtime: 0,
|
||||||
|
playterm: 0,
|
||||||
|
session_cnt: 0,
|
||||||
|
extra_stage: 0,
|
||||||
|
extra_play: 0,
|
||||||
|
extra_clear: 0,
|
||||||
|
encore_play: 0,
|
||||||
|
encore_clear: 0,
|
||||||
|
pencore_play: 0,
|
||||||
|
pencore_clear: 0,
|
||||||
|
max_clear_diff: 0,
|
||||||
|
max_full_diff: 0,
|
||||||
|
max_exce_diff: 0,
|
||||||
|
clear_num: 0,
|
||||||
|
full_num: 0,
|
||||||
|
exce_num: 0,
|
||||||
|
no_num: 0,
|
||||||
|
e_num: 0,
|
||||||
|
d_num: 0,
|
||||||
|
c_num: 0,
|
||||||
|
b_num: 0,
|
||||||
|
a_num: 0,
|
||||||
|
s_num: 0,
|
||||||
|
ss_num: 0,
|
||||||
|
last_category: 0,
|
||||||
|
last_musicid: -1,
|
||||||
|
last_seq: 0,
|
||||||
|
disp_level: 0,
|
||||||
|
progress: 0,
|
||||||
|
disp_state: 0,
|
||||||
|
skill: 0,
|
||||||
|
all_skill: 0,
|
||||||
|
extra_gauge: 0,
|
||||||
|
encore_gauge: 0,
|
||||||
|
encore_cnt: 0,
|
||||||
|
encore_success: 0,
|
||||||
|
unlock_point: 0,
|
||||||
|
max_skill: 0,
|
||||||
|
max_all_skill: 0,
|
||||||
|
clear_diff: 0,
|
||||||
|
full_diff: 0,
|
||||||
|
exce_diff: 0,
|
||||||
|
clear_music_num: 0,
|
||||||
|
full_music_num: 0,
|
||||||
|
exce_music_num: 0,
|
||||||
|
clear_seq_num: 0,
|
||||||
|
classic_all_skill: 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const defaultRecord = (dm): Record => {
|
||||||
|
return {
|
||||||
|
collection: 'record',
|
||||||
|
pluginVer: PLUGIN_VER,
|
||||||
|
|
||||||
|
game: dm ? 'dm' : 'gf',
|
||||||
|
version,
|
||||||
|
|
||||||
|
diff_100_nr: 0,
|
||||||
|
diff_150_nr: 0,
|
||||||
|
diff_200_nr: 0,
|
||||||
|
diff_250_nr: 0,
|
||||||
|
diff_300_nr: 0,
|
||||||
|
diff_350_nr: 0,
|
||||||
|
diff_400_nr: 0,
|
||||||
|
diff_450_nr: 0,
|
||||||
|
diff_500_nr: 0,
|
||||||
|
diff_550_nr: 0,
|
||||||
|
diff_600_nr: 0,
|
||||||
|
diff_650_nr: 0,
|
||||||
|
diff_700_nr: 0,
|
||||||
|
diff_750_nr: 0,
|
||||||
|
diff_800_nr: 0,
|
||||||
|
diff_850_nr: 0,
|
||||||
|
diff_900_nr: 0,
|
||||||
|
diff_950_nr: 0,
|
||||||
|
diff_100_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_150_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_200_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_250_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_300_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_350_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_400_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_450_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_500_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_550_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_600_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_650_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_700_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_750_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_800_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_850_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_900_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
diff_950_clear: [0, 0, 0, 0, 0, 0, 0],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultExtra = (dm): Extra => {
|
||||||
|
return {
|
||||||
|
collection: 'extra',
|
||||||
|
pluginVer: PLUGIN_VER,
|
||||||
|
|
||||||
|
game: dm ? 'dm' : 'gf',
|
||||||
|
version,
|
||||||
|
id,
|
||||||
|
|
||||||
|
playstyle: [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
20,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
20,
|
||||||
|
0,
|
||||||
|
],
|
||||||
|
custom: Array(50).fill(0),
|
||||||
|
list_1: Array(100).fill(-1),
|
||||||
|
list_2: Array(100).fill(-1),
|
||||||
|
list_3: Array(100).fill(-1),
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const gf = { game: 'gf', version };
|
||||||
|
const dm = { game: 'dm', version };
|
||||||
|
|
||||||
|
await DB.Upsert(refid, { collection: 'playerinfo', version }, defaultInfo)
|
||||||
|
await DB.Upsert(refid, { collection: 'profile', ...gf }, defaultProfile(false))
|
||||||
|
await DB.Upsert(refid, { collection: 'profile', ...dm }, defaultProfile(true))
|
||||||
|
await DB.Upsert(refid, { collection: 'record', ...gf }, defaultRecord(false))
|
||||||
|
await DB.Upsert(refid, { collection: 'record', ...dm }, defaultRecord(true))
|
||||||
|
await DB.Upsert(refid, { collection: 'extra', ...gf }, defaultExtra(false))
|
||||||
|
await DB.Upsert(refid, { collection: 'extra', ...dm }, defaultExtra(true))
|
||||||
|
|
||||||
|
return defaultInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
export const savePlayer: EPR = async (info, data, send) => {
|
||||||
|
const refid = $(data).str('player.refid');
|
||||||
|
if (!refid) return send.deny();
|
||||||
|
|
||||||
|
const no = getPlayerNo(data);
|
||||||
|
const version = getVersion(info);
|
||||||
|
const dm = isDM(info);
|
||||||
|
|
||||||
|
const game = dm ? 'dm' : 'gf';
|
||||||
|
|
||||||
|
const profile = await getProfile(refid, version, game) as any;
|
||||||
|
const extra = await getExtra(refid, version, game) as any;
|
||||||
|
const rec = await getRecord(refid, version, game) as any;
|
||||||
|
const dataplayer = $(data).element("player")
|
||||||
|
|
||||||
|
const autoSet = (field: keyof Profile, path: string, array = false): void => {
|
||||||
|
if (array) {
|
||||||
|
profile[field] = dataplayer.content(path, profile[field])
|
||||||
|
} else {
|
||||||
|
profile[field] = dataplayer.content(path, profile[field])[0]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const autoExtra = (field: keyof Extra, path: string, array = false): void => {
|
||||||
|
if (array) {
|
||||||
|
extra[field] = dataplayer.content(path, extra[field])
|
||||||
|
} else {
|
||||||
|
extra[field] = dataplayer.content(path, extra[field])[0]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const autoRec = (field: keyof Record, path: string, array = false): void => {
|
||||||
|
if (array) {
|
||||||
|
rec[field] = dataplayer.content(path, rec[field])
|
||||||
|
} else {
|
||||||
|
rec[field] = dataplayer.content(path, rec[field])[0]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
autoSet('max_skill', 'record.max.skill');
|
||||||
|
autoSet('max_all_skill', 'record.max.all_skill');
|
||||||
|
autoSet('clear_diff', 'record.max.clear_diff');
|
||||||
|
autoSet('full_diff', 'record.max.full_diff');
|
||||||
|
autoSet('exce_diff', 'record.max.exce_diff');
|
||||||
|
autoSet('clear_music_num', 'record.max.clear_music_num');
|
||||||
|
autoSet('full_music_num', 'record.max.full_music_num');
|
||||||
|
autoSet('exce_music_num', 'record.max.exce_music_num');
|
||||||
|
autoSet('clear_seq_num', 'record.max.clear_seq_num');
|
||||||
|
autoSet('classic_all_skill', 'record.max.classic_all_skill');
|
||||||
|
|
||||||
|
autoSet('play', 'playinfo.play');
|
||||||
|
autoSet('playtime', 'playinfo.playtime');
|
||||||
|
autoSet('playterm', 'playinfo.playterm');
|
||||||
|
autoSet('session_cnt', 'playinfo.session_cnt');
|
||||||
|
autoSet('extra_stage', 'playinfo.extra_stage');
|
||||||
|
autoSet('extra_play', 'playinfo.extra_play');
|
||||||
|
autoSet('extra_clear', 'playinfo.extra_clear');
|
||||||
|
autoSet('encore_play', 'playinfo.encore_play');
|
||||||
|
autoSet('encore_clear', 'playinfo.encore_clear');
|
||||||
|
autoSet('pencore_play', 'playinfo.pencore_play');
|
||||||
|
autoSet('pencore_clear', 'playinfo.pencore_clear');
|
||||||
|
autoSet('max_clear_diff', 'playinfo.max_clear_diff');
|
||||||
|
autoSet('max_full_diff', 'playinfo.max_full_diff');
|
||||||
|
autoSet('max_exce_diff', 'playinfo.max_exce_diff');
|
||||||
|
autoSet('clear_num', 'playinfo.clear_num');
|
||||||
|
autoSet('full_num', 'playinfo.full_num');
|
||||||
|
autoSet('exce_num', 'playinfo.exce_num');
|
||||||
|
autoSet('no_num', 'playinfo.no_num');
|
||||||
|
autoSet('e_num', 'playinfo.e_num');
|
||||||
|
autoSet('d_num', 'playinfo.d_num');
|
||||||
|
autoSet('c_num', 'playinfo.c_num');
|
||||||
|
autoSet('b_num', 'playinfo.b_num');
|
||||||
|
autoSet('a_num', 'playinfo.a_num');
|
||||||
|
autoSet('s_num', 'playinfo.s_num');
|
||||||
|
autoSet('ss_num', 'playinfo.ss_num');
|
||||||
|
autoSet('last_category', 'playinfo.last_category');
|
||||||
|
autoSet('last_musicid', 'playinfo.last_musicid');
|
||||||
|
autoSet('last_seq', 'playinfo.last_seq');
|
||||||
|
autoSet('disp_level', 'playinfo.disp_level');
|
||||||
|
|
||||||
|
autoSet('extra_gauge', 'groove.extra_gauge');
|
||||||
|
autoSet('encore_gauge', 'groove.encore_gauge');
|
||||||
|
autoSet('encore_cnt', 'groove.encore_cnt');
|
||||||
|
autoSet('encore_success', 'groove.encore_success');
|
||||||
|
autoSet('unlock_point', 'groove.unlock_point');
|
||||||
|
|
||||||
|
autoSet('progress', 'tutorial.progress');
|
||||||
|
autoSet('disp_state', 'tutorial.disp_state');
|
||||||
|
|
||||||
|
autoSet('skill', 'skilldata.skill');
|
||||||
|
autoSet('all_skill', 'skilldata.all_skill');
|
||||||
|
|
||||||
|
autoRec('diff_100_nr', 'record.diff.diff_100_nr');
|
||||||
|
autoRec('diff_150_nr', 'record.diff.diff_150_nr');
|
||||||
|
autoRec('diff_200_nr', 'record.diff.diff_200_nr');
|
||||||
|
autoRec('diff_250_nr', 'record.diff.diff_250_nr');
|
||||||
|
autoRec('diff_300_nr', 'record.diff.diff_300_nr');
|
||||||
|
autoRec('diff_350_nr', 'record.diff.diff_350_nr');
|
||||||
|
autoRec('diff_400_nr', 'record.diff.diff_400_nr');
|
||||||
|
autoRec('diff_450_nr', 'record.diff.diff_450_nr');
|
||||||
|
autoRec('diff_500_nr', 'record.diff.diff_500_nr');
|
||||||
|
autoRec('diff_550_nr', 'record.diff.diff_550_nr');
|
||||||
|
autoRec('diff_600_nr', 'record.diff.diff_600_nr');
|
||||||
|
autoRec('diff_650_nr', 'record.diff.diff_650_nr');
|
||||||
|
autoRec('diff_700_nr', 'record.diff.diff_700_nr');
|
||||||
|
autoRec('diff_750_nr', 'record.diff.diff_750_nr');
|
||||||
|
autoRec('diff_800_nr', 'record.diff.diff_800_nr');
|
||||||
|
autoRec('diff_850_nr', 'record.diff.diff_850_nr');
|
||||||
|
autoRec('diff_900_nr', 'record.diff.diff_900_nr');
|
||||||
|
autoRec('diff_950_nr', 'record.diff.diff_950_nr');
|
||||||
|
autoRec('diff_100_clear', 'record.diff.diff_100_clear', true);
|
||||||
|
autoRec('diff_150_clear', 'record.diff.diff_150_clear', true);
|
||||||
|
autoRec('diff_200_clear', 'record.diff.diff_200_clear', true);
|
||||||
|
autoRec('diff_250_clear', 'record.diff.diff_250_clear', true);
|
||||||
|
autoRec('diff_300_clear', 'record.diff.diff_300_clear', true);
|
||||||
|
autoRec('diff_350_clear', 'record.diff.diff_350_clear', true);
|
||||||
|
autoRec('diff_400_clear', 'record.diff.diff_400_clear', true);
|
||||||
|
autoRec('diff_450_clear', 'record.diff.diff_450_clear', true);
|
||||||
|
autoRec('diff_500_clear', 'record.diff.diff_500_clear', true);
|
||||||
|
autoRec('diff_550_clear', 'record.diff.diff_550_clear', true);
|
||||||
|
autoRec('diff_600_clear', 'record.diff.diff_600_clear', true);
|
||||||
|
autoRec('diff_650_clear', 'record.diff.diff_650_clear', true);
|
||||||
|
autoRec('diff_700_clear', 'record.diff.diff_700_clear', true);
|
||||||
|
autoRec('diff_750_clear', 'record.diff.diff_750_clear', true);
|
||||||
|
autoRec('diff_800_clear', 'record.diff.diff_800_clear', true);
|
||||||
|
autoRec('diff_850_clear', 'record.diff.diff_850_clear', true);
|
||||||
|
autoRec('diff_900_clear', 'record.diff.diff_900_clear', true);
|
||||||
|
autoRec('diff_950_clear', 'record.diff.diff_950_clear', true);
|
||||||
|
|
||||||
|
autoExtra('list_1', 'favoritemusic.music_list_1', true);
|
||||||
|
autoExtra('list_2', 'favoritemusic.music_list_2', true);
|
||||||
|
autoExtra('list_3', 'favoritemusic.music_list_3', true);
|
||||||
|
|
||||||
|
autoExtra('playstyle', 'customdata.playstyle', true);
|
||||||
|
autoExtra('custom', 'customdata.custom', true);
|
||||||
|
|
||||||
|
await DB.Upsert(refid, { collection: 'profile', game, version }, profile)
|
||||||
|
await DB.Upsert(refid, { collection: 'record', game, version }, rec)
|
||||||
|
await DB.Upsert(refid, { collection: 'extra', game, version }, extra)
|
||||||
|
|
||||||
|
const stages = $(data).elements('player.stage');
|
||||||
|
for (const stage of stages) {
|
||||||
|
const mid = stage.content('musicid', -1);
|
||||||
|
const seq = stage.content('seq', -1);
|
||||||
|
|
||||||
|
if (mid < 0 || seq < 0) continue;
|
||||||
|
|
||||||
|
// const skill = stage.content('skill', 0);
|
||||||
|
const newSkill = stage.content('new_skill', 0);
|
||||||
|
const clear = stage.bool('clear');
|
||||||
|
const fc = stage.bool('fullcombo');
|
||||||
|
const ex = stage.bool('excellent');
|
||||||
|
|
||||||
|
const perc = stage.content('perc', 0);
|
||||||
|
const rank = stage.content('rank', 0);
|
||||||
|
const meter = stage.bigint('meter', BigInt(0));
|
||||||
|
const prog = stage.content('meter_prog', 0);
|
||||||
|
|
||||||
|
|
||||||
|
const score = (await DB.FindOne<Scores>(refid, {
|
||||||
|
collection: 'scores',
|
||||||
|
mid,
|
||||||
|
version,
|
||||||
|
game
|
||||||
|
})) || {
|
||||||
|
collection: 'scores',
|
||||||
|
game,
|
||||||
|
version,
|
||||||
|
pluginVer: PLUGIN_VER,
|
||||||
|
mid,
|
||||||
|
update: [0, 0],
|
||||||
|
diffs: {}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (newSkill > score.update[1]) {
|
||||||
|
score.update[0] = seq;
|
||||||
|
score.update[1] = newSkill;
|
||||||
|
}
|
||||||
|
|
||||||
|
score.diffs[seq] = {
|
||||||
|
perc: Math.max(_.get(score.diffs[seq], 'perc', 0), perc),
|
||||||
|
rank: Math.max(_.get(score.diffs[seq], 'rank', 0), rank),
|
||||||
|
meter: meter.toString(),
|
||||||
|
prog: Math.max(_.get(score.diffs[seq], 'prog', 0), prog),
|
||||||
|
clear: _.get(score.diffs[seq], 'clear') || clear,
|
||||||
|
fc: _.get(score.diffs[seq], 'fc') || fc,
|
||||||
|
ex: _.get(score.diffs[seq], 'ex') || ex,
|
||||||
|
};
|
||||||
|
|
||||||
|
await DB.Upsert(refid, {
|
||||||
|
collection: 'scores',
|
||||||
|
mid,
|
||||||
|
version,
|
||||||
|
game
|
||||||
|
}, score)
|
||||||
|
}
|
||||||
|
|
||||||
|
await send.object({
|
||||||
|
player: K.ATTR({ no: `${no}` }, {
|
||||||
|
skill: { rank: K.ITEM('s32', 1), total_nr: K.ITEM('s32', 1) },
|
||||||
|
all_skill: { rank: K.ITEM('s32', 1), total_nr: K.ITEM('s32', 1) },
|
||||||
|
kac2018: {
|
||||||
|
data: {
|
||||||
|
term: K.ITEM('s32', 0),
|
||||||
|
total_score: K.ITEM('s32', 0),
|
||||||
|
score: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||||
|
music_type: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||||
|
play_count: K.ARRAY('s32', [0, 0, 0, 0, 0, 0]),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
gamemode: _.get(data, 'gamemode'),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
async function getProfile(refid: string, version: string, game: 'gf' | 'dm') {
|
||||||
|
return await DB.FindOne<Profile>(refid, {
|
||||||
|
collection: 'profile',
|
||||||
|
version: version,
|
||||||
|
game: game
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getExtra(refid: string, version: string, game: 'gf' | 'dm') {
|
||||||
|
return await DB.FindOne<Extra>(refid, {
|
||||||
|
collection: 'extra',
|
||||||
|
version: version,
|
||||||
|
game: game
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getRecord(refid: string, version: string, game: 'gf' | 'dm') {
|
||||||
|
return await DB.FindOne<Record>(refid, {
|
||||||
|
collection: 'record',
|
||||||
|
version: version,
|
||||||
|
game: game
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getScores(refid: string, version: string, game: 'gf' | 'dm') {
|
||||||
|
return (await DB.Find<Scores>(refid, {
|
||||||
|
collection: 'scores',
|
||||||
|
version: version,
|
||||||
|
game: game
|
||||||
|
}))
|
||||||
|
}
|
||||||
45
gitadora@asphyxia/index.ts
Normal file
45
gitadora@asphyxia/index.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
import { gameInfoGet, shopInfoRegist } from "./handlers/info";
|
||||||
|
import { playableMusic } from "./handlers/MusicList"
|
||||||
|
import { getPlayer, check, regist, savePlayer } from "./handlers/profiles";
|
||||||
|
import { updatePlayerInfo } from "./models/webui";
|
||||||
|
|
||||||
|
export function register() {
|
||||||
|
R.GameCode('M32');
|
||||||
|
|
||||||
|
R.Config("enable_custom_mdb", {
|
||||||
|
name: "Enable Custom MDB",
|
||||||
|
desc: "For who uses own MDB",
|
||||||
|
type: "boolean",
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
R.Config("custom_mdb_path", {
|
||||||
|
name: "Custom MDB PATH",
|
||||||
|
desc: "You need to enabled Custom MDB option first. USE ABSOLUTE PATH !!",
|
||||||
|
type: "string",
|
||||||
|
default: "",
|
||||||
|
})
|
||||||
|
|
||||||
|
R.WebUIEvent('updatePlayerInfo', updatePlayerInfo);
|
||||||
|
|
||||||
|
const MultiRoute = (method: string, handler: EPR | boolean) => {
|
||||||
|
// Helper for register multiple versions.
|
||||||
|
R.Route(`exchain_${method}`, handler);
|
||||||
|
R.Route(`matixx_${method}`, handler);
|
||||||
|
// TODO: NEXTAGE
|
||||||
|
// TODO: TB, TBRE and more older version?
|
||||||
|
};
|
||||||
|
|
||||||
|
// Info
|
||||||
|
MultiRoute('shopinfo.regist', shopInfoRegist)
|
||||||
|
MultiRoute('gameinfo.get', gameInfoGet)
|
||||||
|
|
||||||
|
// MusicList
|
||||||
|
MultiRoute('playablemusic.get', playableMusic)
|
||||||
|
|
||||||
|
// Profile
|
||||||
|
MultiRoute('cardutil.regist', regist);
|
||||||
|
MultiRoute('cardutil.check', check);
|
||||||
|
MultiRoute('gametop.get', getPlayer);
|
||||||
|
MultiRoute('gameend.regist', savePlayer);
|
||||||
|
}
|
||||||
14
gitadora@asphyxia/models/extra.ts
Normal file
14
gitadora@asphyxia/models/extra.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
export interface Extra {
|
||||||
|
collection: 'extra';
|
||||||
|
|
||||||
|
game: 'gf' | 'dm';
|
||||||
|
version: string;
|
||||||
|
pluginVer: number
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
playstyle: number[];
|
||||||
|
custom: number[];
|
||||||
|
list_1: number[];
|
||||||
|
list_2: number[];
|
||||||
|
list_3: number[];
|
||||||
|
}
|
||||||
19
gitadora@asphyxia/models/playerinfo.ts
Normal file
19
gitadora@asphyxia/models/playerinfo.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
export interface PlayerInfo {
|
||||||
|
collection: 'playerinfo',
|
||||||
|
|
||||||
|
pluginVer: Number;
|
||||||
|
|
||||||
|
id: number;
|
||||||
|
version: string,
|
||||||
|
name: string;
|
||||||
|
title: string;
|
||||||
|
|
||||||
|
card?: {
|
||||||
|
id: number;
|
||||||
|
position: number[];
|
||||||
|
scale: number[];
|
||||||
|
rotation: number;
|
||||||
|
}[];
|
||||||
|
|
||||||
|
// TODO: Add Board things.
|
||||||
|
}
|
||||||
57
gitadora@asphyxia/models/profile.ts
Normal file
57
gitadora@asphyxia/models/profile.ts
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
export interface Profile {
|
||||||
|
collection: 'profile';
|
||||||
|
|
||||||
|
game: 'gf' | 'dm';
|
||||||
|
version: string;
|
||||||
|
pluginVer: number
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
play: number;
|
||||||
|
playtime: number;
|
||||||
|
playterm: number;
|
||||||
|
session_cnt: number;
|
||||||
|
extra_stage: number;
|
||||||
|
extra_play: number;
|
||||||
|
extra_clear: number;
|
||||||
|
encore_play: number;
|
||||||
|
encore_clear: number;
|
||||||
|
pencore_play: number;
|
||||||
|
pencore_clear: number;
|
||||||
|
max_clear_diff: number;
|
||||||
|
max_full_diff: number;
|
||||||
|
max_exce_diff: number;
|
||||||
|
clear_num: number;
|
||||||
|
full_num: number;
|
||||||
|
exce_num: number;
|
||||||
|
no_num: number;
|
||||||
|
e_num: number;
|
||||||
|
d_num: number;
|
||||||
|
c_num: number;
|
||||||
|
b_num: number;
|
||||||
|
a_num: number;
|
||||||
|
s_num: number;
|
||||||
|
ss_num: number;
|
||||||
|
last_category: number;
|
||||||
|
last_musicid: number;
|
||||||
|
last_seq: number;
|
||||||
|
disp_level: number;
|
||||||
|
progress: number;
|
||||||
|
disp_state: number;
|
||||||
|
skill: number;
|
||||||
|
all_skill: number;
|
||||||
|
extra_gauge: number;
|
||||||
|
encore_gauge: number;
|
||||||
|
encore_cnt: number;
|
||||||
|
encore_success: number;
|
||||||
|
unlock_point: number;
|
||||||
|
max_skill: number;
|
||||||
|
max_all_skill: number;
|
||||||
|
clear_diff: number;
|
||||||
|
full_diff: number;
|
||||||
|
exce_diff: number;
|
||||||
|
clear_music_num: number;
|
||||||
|
full_music_num: number;
|
||||||
|
exce_music_num: number;
|
||||||
|
clear_seq_num: number;
|
||||||
|
classic_all_skill: number;
|
||||||
|
}
|
||||||
44
gitadora@asphyxia/models/record.ts
Normal file
44
gitadora@asphyxia/models/record.ts
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
export interface Record {
|
||||||
|
collection: 'record';
|
||||||
|
|
||||||
|
game: 'gf' | 'dm';
|
||||||
|
version: string;
|
||||||
|
pluginVer: number
|
||||||
|
|
||||||
|
diff_100_nr: number;
|
||||||
|
diff_150_nr: number;
|
||||||
|
diff_200_nr: number;
|
||||||
|
diff_250_nr: number;
|
||||||
|
diff_300_nr: number;
|
||||||
|
diff_350_nr: number;
|
||||||
|
diff_400_nr: number;
|
||||||
|
diff_450_nr: number;
|
||||||
|
diff_500_nr: number;
|
||||||
|
diff_550_nr: number;
|
||||||
|
diff_600_nr: number;
|
||||||
|
diff_650_nr: number;
|
||||||
|
diff_700_nr: number;
|
||||||
|
diff_750_nr: number;
|
||||||
|
diff_800_nr: number;
|
||||||
|
diff_850_nr: number;
|
||||||
|
diff_900_nr: number;
|
||||||
|
diff_950_nr: number;
|
||||||
|
diff_100_clear: number[];
|
||||||
|
diff_150_clear: number[];
|
||||||
|
diff_200_clear: number[];
|
||||||
|
diff_250_clear: number[];
|
||||||
|
diff_300_clear: number[];
|
||||||
|
diff_350_clear: number[];
|
||||||
|
diff_400_clear: number[];
|
||||||
|
diff_450_clear: number[];
|
||||||
|
diff_500_clear: number[];
|
||||||
|
diff_550_clear: number[];
|
||||||
|
diff_600_clear: number[];
|
||||||
|
diff_650_clear: number[];
|
||||||
|
diff_700_clear: number[];
|
||||||
|
diff_750_clear: number[];
|
||||||
|
diff_800_clear: number[];
|
||||||
|
diff_850_clear: number[];
|
||||||
|
diff_900_clear: number[];
|
||||||
|
diff_950_clear: number[];
|
||||||
|
}
|
||||||
23
gitadora@asphyxia/models/scores.ts
Normal file
23
gitadora@asphyxia/models/scores.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
export interface Scores {
|
||||||
|
collection: 'scores';
|
||||||
|
|
||||||
|
game: 'gf' | 'dm';
|
||||||
|
version: string;
|
||||||
|
pluginVer: number
|
||||||
|
|
||||||
|
mid: number,
|
||||||
|
|
||||||
|
update: number[];
|
||||||
|
|
||||||
|
diffs: {
|
||||||
|
[seq: string]: {
|
||||||
|
perc: number;
|
||||||
|
rank: number;
|
||||||
|
clear: boolean;
|
||||||
|
fc: boolean;
|
||||||
|
ex: boolean;
|
||||||
|
meter: string;
|
||||||
|
prog: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
28
gitadora@asphyxia/models/webui.ts
Normal file
28
gitadora@asphyxia/models/webui.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
import { PlayerInfo } from "../models/playerinfo"
|
||||||
|
|
||||||
|
export const updatePlayerInfo = async (data: {
|
||||||
|
refid: string;
|
||||||
|
version: string;
|
||||||
|
name?: string;
|
||||||
|
title?: string;
|
||||||
|
}) => {
|
||||||
|
if (data.refid == null) return;
|
||||||
|
|
||||||
|
const update: Update<PlayerInfo>['$set'] = {};
|
||||||
|
|
||||||
|
if (data.name && data.name.length > 0) {
|
||||||
|
//TODO: name validator
|
||||||
|
update.name = data.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.title && data.title.length > 0) {
|
||||||
|
//TODO: title validator
|
||||||
|
update.title = data.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
await DB.Update<PlayerInfo>(
|
||||||
|
data.refid,
|
||||||
|
{ collection: 'playerinfo', version: data.version },
|
||||||
|
{ $set: update }
|
||||||
|
);
|
||||||
|
};
|
||||||
12
gitadora@asphyxia/utils.ts
Normal file
12
gitadora@asphyxia/utils.ts
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
export const isGF = (info: EamuseInfo) => {
|
||||||
|
return info.model.split(':')[2] == 'A';
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isDM = (info: EamuseInfo) => {
|
||||||
|
return info.model.split(':')[2] == 'B';
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getVersion = (info: EamuseInfo) => {
|
||||||
|
const moduleName: string = info.module;
|
||||||
|
return moduleName.match(/([^_]*)_(.*)/)[1];
|
||||||
|
};
|
||||||
36
gitadora@asphyxia/webui/profile_detail.pug
Normal file
36
gitadora@asphyxia/webui/profile_detail.pug
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
//DATA//
|
||||||
|
info: DB.Find(refid, { collection: 'playerinfo' })
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
div
|
||||||
|
each i in info
|
||||||
|
.card
|
||||||
|
.card-header
|
||||||
|
p.card-header-title
|
||||||
|
span.icon
|
||||||
|
i.mdi.mdi-account-edit
|
||||||
|
| User Detail (#{i.version})
|
||||||
|
.card-content
|
||||||
|
form(method="post" action="/emit/updatePlayerInfo")
|
||||||
|
.field
|
||||||
|
label.label ID
|
||||||
|
.control
|
||||||
|
input.input(type="text" name="refid", value=refid readonly)
|
||||||
|
.field
|
||||||
|
label.label Version
|
||||||
|
.control
|
||||||
|
input.input(type="text" name="version", value=i.version readonly)
|
||||||
|
.field
|
||||||
|
label.label Name
|
||||||
|
.control
|
||||||
|
input.input(type="text" name="name", value=i.name)
|
||||||
|
.field
|
||||||
|
label.label Title
|
||||||
|
.control
|
||||||
|
input.input(type="text" name="title", value=i.title)
|
||||||
|
.field
|
||||||
|
button.button.is-primary(type="submit")
|
||||||
|
span.icon
|
||||||
|
i.mdi.mdi-check
|
||||||
|
span Submit
|
||||||
Loading…
Reference in New Issue
Block a user