IIDX: Added error message for incompatible score database

IIDX: Fixed where unable to login after step up (rootage)
IIDX: Reverted `v0.1.15` dev mode hackjob codes
IIDX: Line Encoding changes, misc
This commit is contained in:
duel0213 2025-03-21 21:04:13 +09:00
parent 11cbbb9e7a
commit 8bbe8390eb
18 changed files with 1386 additions and 1376 deletions

View File

@ -142,8 +142,8 @@ Changelogs
- Added Experimental Badge saving support
- Added Experimental score import/export
- Fixed where plugin may fail to register due to missing types in dev mode (invalid setup for dev, just enough to get around)
- Fixed where pacemaker isn't working as intended due to malformed ghost data on music.appoint response (~ DJ TROOPERS)
- Fixed where unable to login after first-play (SPADA, SINOBUZ, Rootage)
- Fixed where pacemaker isn't working as intended due to malformed ghost data on music.appoint response (~ DJ TROOPERS)
- Fixed where pacemaker isn't working as intented due to wrong condition check (HEROIC VERSE ~)
- Fixed where pacemaker sub-type isn't load correctly (HEROIC VERSE ~)
- Fixed where QPRO data doesn't get saved in WebUI
@ -154,7 +154,13 @@ Changelogs
- Fixed where lightning settings doesn't get saved on logout
- Fixed where Disable Music Preview, Disable HCN Color, VEFX Lock settings doesn't reflect
- Fixed where MISS COUNT has 0 as default (including score import)
- Fixed where unable to import DP scores
- Fixed where MISS COUNT doesn't get updated when exscore is same
- Fixed where lightning model settings saved incorrectly
- Fixed where unable to import score if user has DP scores
- Fixed where unable to achieve dan if you failed once
- Fixed where unable to login (tricoro, CastHour, Rootage)
- Fixed where unable to specify rival in WebUI
- Fixed where music.arenaCPU isn't working as intended due to change of type (EPOLIS ~)
- Added error message for invalid score database entries
- Reverted `v0.1.15` dev mode related code changes (now requires proper dev setup, refer parent README.md)
- WebUI is now display values of corresponding version

View File

@ -3,37 +3,45 @@
"0": {
"15": {
"music_id": [ 25090, 23068, 19004, 29045 ],
"class_id": [ 3, 3, 3, 3 ]
"class_id": [ 3, 3, 3, 3 ],
"kind": 0
},
"16": {
"music_id": [ 23005, 27078, 22065, 27060 ],
"class_id": [ 3, 3, 3, 3 ]
"class_id": [ 3, 3, 3, 3 ],
"kind": 0
},
"17": {
"music_id": [ 29007, 26108, 19002, 18004 ],
"class_id": [ 3, 3, 3, 3 ]
"class_id": [ 3, 3, 3, 3 ],
"kind": 0
},
"18": {
"music_id": [ 25007, 18032, 16020, 12004 ],
"class_id": [ 3, 3, 3, 3 ]
"class_id": [ 3, 3, 3, 3 ],
"kind": 0
}
},
"1": {
"15": {
"music_id": [ 15032, 29033, 27092, 30020 ],
"class_id": [ 3, 3, 3, 3 ]
"class_id": [ 3, 3, 3, 3 ],
"kind": 0
},
"16": {
"music_id": [ 10028, 26070, 28091, 23075 ],
"class_id": [ 3, 3, 3, 3 ]
"class_id": [ 3, 3, 3, 3 ],
"kind": 0
},
"17": {
"music_id": [ 26012, 28002, 17017, 28005 ],
"class_id": [ 3, 3, 3, 3 ]
"class_id": [ 3, 3, 3, 3 ],
"kind": 0
},
"18": {
"music_id": [ 28008, 15001, 19002, 9028 ],
"class_id": [ 3, 3, 3, 3 ]
"class_id": [ 3, 3, 3, 3 ],
"kind": 0
}
}
}

View File

@ -17,7 +17,7 @@ export const gssysteminfo: EPR = async (info, data, send) => {
}
// following datas are made up needs to figure out correct way to do it //
let music_open = JSON.parse(await IO.ReadFile("data/music_open.json"));
let music_open = JSON.parse(await IO.ReadFile("data/music_open.json", "utf-8"));
if (!_.isNil(music_open[version])) {
result = {
...result,
@ -36,10 +36,11 @@ export const gssysteminfo: EPR = async (info, data, send) => {
});
}
if (version >= 31) {
switch (version) {
case 31:
result.arena_schedule = {
...result.arena_schedule,
rule_type: K.ITEM("u8", 0),
rule_type: K.ITEM("u8", 0), // arena rule for online //
}
result = {
@ -48,7 +49,7 @@ export const gssysteminfo: EPR = async (info, data, send) => {
}
// following datas are made up needs to figure out correct way to do it //
let grade = JSON.parse(await IO.ReadFile("data/grade.json"));
let grade = JSON.parse(await IO.ReadFile("data/grade.json", "utf-8"));
if (!_.isNil(grade[version])) {
Object.keys(grade[version]).forEach(s => {
Object.keys(grade[version][s]).forEach(c => {
@ -66,11 +67,14 @@ export const gssysteminfo: EPR = async (info, data, send) => {
class_id_3: K.ITEM("s32", grade[version][s][c].class_id[3]),
index: K.ITEM("s32", result.grade_course.length),
cube_num: K.ITEM("s32", 0),
kind: K.ITEM("s32", 0),
kind: K.ITEM("s32", grade[version][s][c].kind),
});
});
});
}
default:
break;
}
// arena_music_difficult //

View File

@ -1,4 +1,4 @@
import { IDtoRef, Base64toNumArray, GetVersion, OldMidToNewMid, NewMidToOldMid, ReftoProfile, ReftoPcdata, ClidToPlaySide, ReftoQPRO, NumArrayToString, OldMidToVerMid, HextoBase64, NumArraytoBase64, NumArraytoHex } from "../util";
import { IDtoRef, GetVersion, OldMidToNewMid, NewMidToOldMid, ReftoProfile, ReftoPcdata, ClidToPlaySide, ReftoQPRO, NumArrayToString, OldMidToVerMid } from "../util";
import { score, score_top } from "../models/score";
import { profile } from "../models/profile";
import { shop_data } from "../models/shop";
@ -7,8 +7,8 @@ import { badge } from "../models/badge";
export const musicgetrank: EPR = async (info, data, send) => {
const version = GetVersion(info);
const refid = await IDtoRef(parseInt($(data).attr().iidxid));
const cltype = parseInt($(data).attr().cltype); // 0 -> SP, 1 -> DP //
const refid = await IDtoRef(Number($(data).attr().iidxid));
const cltype = Number($(data).attr().cltype); // 0 -> SP, 1 -> DP //
const music_data: any = (
await DB.Find(refid, {
collection: "score",
@ -16,11 +16,11 @@ export const musicgetrank: EPR = async (info, data, send) => {
);
const rival_refids = [
[parseInt($(data).attr().iidxid0), await IDtoRef(parseInt($(data).attr().iidxid0))],
[parseInt($(data).attr().iidxid1), await IDtoRef(parseInt($(data).attr().iidxid1))],
[parseInt($(data).attr().iidxid2), await IDtoRef(parseInt($(data).attr().iidxid2))],
[parseInt($(data).attr().iidxid3), await IDtoRef(parseInt($(data).attr().iidxid3))],
[parseInt($(data).attr().iidxid4), await IDtoRef(parseInt($(data).attr().iidxid4))],
[Number($(data).attr().iidxid0), await IDtoRef(Number($(data).attr().iidxid0))],
[Number($(data).attr().iidxid1), await IDtoRef(Number($(data).attr().iidxid1))],
[Number($(data).attr().iidxid2), await IDtoRef(Number($(data).attr().iidxid2))],
[Number($(data).attr().iidxid3), await IDtoRef(Number($(data).attr().iidxid3))],
[Number($(data).attr().iidxid4), await IDtoRef(Number($(data).attr().iidxid4))],
];
let m = [], top = [], b = [], t = [];
@ -32,6 +32,8 @@ export const musicgetrank: EPR = async (info, data, send) => {
};
indices = cltype === 0 ? [1, 2, 3] : [6, 7, 8];
music_data.forEach((res: score) => {
if (_.isNil(res.cArray)) throw new Error("[music.getrank] There is unsupported entry in Database");
temp_mid = NewMidToOldMid(res.mid);
let verMid = OldMidToVerMid(temp_mid);
@ -45,7 +47,7 @@ export const musicgetrank: EPR = async (info, data, send) => {
K.ITEM("str", NumArrayToString(
[7, 4, 13, 3, 3],
[verMid[1], a, res.esArray[indices[a]], rank_id, res.cArray[indices[a]]] // 4th element is rid (rank_id) //
), { v: String(verMid[0]) } )
), { v: String(verMid[0]) })
);
}
@ -79,6 +81,8 @@ export const musicgetrank: EPR = async (info, data, send) => {
else if (version < 20) {
indices = cltype === 0 ? [1, 2, 3] : [6, 7, 8];
music_data.forEach((res: score) => {
if (_.isNil(res.cArray)) throw new Error("[music.getrank] There is unsupported entry in Database");
temp_mid = NewMidToOldMid(res.mid);
let mVersion = Math.floor(temp_mid / 100);
if (mVersion > version) return;
@ -124,6 +128,8 @@ export const musicgetrank: EPR = async (info, data, send) => {
else indices = cltype === 0 ? [1, 2, 3] : [6, 7, 8];
music_data.forEach((res: score) => {
if (_.isNil(res.cArray)) throw new Error("[music.getrank] There is unsupported entry in Database");
let mVersion = Math.floor(res.mid / 1000);
if (mVersion > version) return;
@ -190,7 +196,7 @@ export const musicgetrank: EPR = async (info, data, send) => {
}
return send.object({
style: K.ATTR({type: String(cltype)}),
style: K.ATTR({ type: String(cltype) }),
m,
b,
top,
@ -209,19 +215,19 @@ export const musicgetrank: EPR = async (info, data, send) => {
export const musicgetralive: EPR = async (info, data, send) => {
const version = GetVersion(info);
const refid = await IDtoRef(parseInt($(data).attr().iidxid));
const cltype = parseInt($(data).attr().cltype); // 0 -> SP, 1 -> DP //
const refid = await IDtoRef(Number($(data).attr().iidxid));
const cltype = Number($(data).attr().cltype); // 0 -> SP, 1 -> DP //
const music_data: any = (
await DB.Find(refid, {
collection: "score",
})
);
const rival_refids = [
[parseInt($(data).attr().iidxid0), await IDtoRef(parseInt($(data).attr().iidxid0))],
[parseInt($(data).attr().iidxid1), await IDtoRef(parseInt($(data).attr().iidxid1))],
[parseInt($(data).attr().iidxid2), await IDtoRef(parseInt($(data).attr().iidxid2))],
[parseInt($(data).attr().iidxid3), await IDtoRef(parseInt($(data).attr().iidxid3))],
[parseInt($(data).attr().iidxid4), await IDtoRef(parseInt($(data).attr().iidxid4))],
[Number($(data).attr().iidxid0), await IDtoRef(Number($(data).attr().iidxid0))],
[Number($(data).attr().iidxid1), await IDtoRef(Number($(data).attr().iidxid1))],
[Number($(data).attr().iidxid2), await IDtoRef(Number($(data).attr().iidxid2))],
[Number($(data).attr().iidxid3), await IDtoRef(Number($(data).attr().iidxid3))],
[Number($(data).attr().iidxid4), await IDtoRef(Number($(data).attr().iidxid4))],
];
let result = {
@ -232,6 +238,8 @@ export const musicgetralive: EPR = async (info, data, send) => {
let indices = cltype === 0 ? [1, 2, 3] : [6, 7, 8];
music_data.forEach((res: score) => {
if (_.isNil(res.cArray)) throw new Error("[music.getralive] There is unsupported entry in Database");
myRecord[NewMidToOldMid(res.mid)] = [...res.esArray, ...res.cArray];
});
@ -287,11 +295,11 @@ export const musicappoint: EPR = async (info, data, send) => {
const version = GetVersion(info);
// clid, ctype, grd, iidxid, lv, mid, subtype //
const refid = await IDtoRef(parseInt($(data).attr().iidxid));
const ctype = parseInt($(data).attr().ctype);
const subtype = parseInt($(data).attr().subtype);
let mid = parseInt($(data).attr().mid);
let clid = parseInt($(data).attr().clid);
const refid = await IDtoRef(Number($(data).attr().iidxid));
const ctype = Number($(data).attr().ctype);
const subtype = Number($(data).attr().subtype);
let mid = Number($(data).attr().mid);
let clid = Number($(data).attr().clid);
const mapping = [1, 2, 3, 6, 7, 8];
if (version < 20) {
@ -320,8 +328,8 @@ export const musicappoint: EPR = async (info, data, send) => {
}
}
if (version < 16) mydata = K.ITEM("str", NumArraytoHex(Base64toNumArray(music_data[clid])));
else mydata = K.ITEM("bin", Base64toNumArray(music_data[clid]));
if (version < 16) mydata = K.ITEM("str", Buffer.from(music_data[clid], "base64").toString("hex").toUpperCase());
else mydata = K.ITEM("bin", Buffer.from(music_data[clid], "base64"));
}
/*** ctype
@ -357,7 +365,7 @@ export const musicappoint: EPR = async (info, data, send) => {
if (_.isNaN(other_pcdata) || _.isNil(other_musicdata)) break;
if (version < 16) {
sdata = K.ITEM("str", NumArraytoHex(Base64toNumArray(other_musicdata[clid])), {
sdata = K.ITEM("str", Buffer.from(other_musicdata[clid], "base64").toString("hex").toUpperCase(), {
score: String(other_musicdata.esArray[clid]),
pid: String(other_profile[1]),
name: String(other_profile[0]),
@ -365,7 +373,7 @@ export const musicappoint: EPR = async (info, data, send) => {
});
}
else {
sdata = K.ITEM("bin", Base64toNumArray(other_musicdata[clid]), {
sdata = K.ITEM("bin", Buffer.from(other_musicdata[clid], "base64"), {
score: String(other_musicdata.esArray[clid]),
pid: String(other_profile[1]),
name: String(other_profile[0]),
@ -383,8 +391,8 @@ export const musicappoint: EPR = async (info, data, send) => {
if (_.isNil(mydata) && _.isNil(sdata)) return send.success();
if (version >= 27) {
let my_gauge_data = null;
if (!_.isNil(music_data)) my_gauge_data = Base64toNumArray(music_data[clid + 10]);
let my_gauge_data = Buffer.alloc(0), other_gauge_data = Buffer.alloc(0);
if (!_.isNil(music_data[clid + 10])) my_gauge_data = Buffer.from(music_data[clid + 10], "base64");
if (!_.isNil(sdata)) {
if (_.isNil(other_musicdata.optArray)) { // migration //
@ -392,7 +400,7 @@ export const musicappoint: EPR = async (info, data, send) => {
other_musicdata.opt2Array = Array<number>(10).fill(0);
}
let other_data = K.ITEM("bin", Base64toNumArray(other_musicdata[clid]), {
let other_data = K.ITEM("bin", Buffer.from(other_musicdata[clid], "base64"), {
score: String(other_musicdata.esArray[clid]),
achieve: String(other_pcdata[ClidToPlaySide(clid) + 2]),
pid: String(other_profile[1]),
@ -402,9 +410,10 @@ export const musicappoint: EPR = async (info, data, send) => {
option2: String(other_musicdata.opt2Array[clid]),
});
if (!_.isNil(other_musicdata[clid + 10])) other_gauge_data = Buffer.from(other_musicdata[clid + 10], "base64");
sdata = {
...other_data,
gauge_data: K.ITEM("bin", Base64toNumArray(other_musicdata[clid + 10]))
gauge_data: K.ITEM("bin", other_gauge_data)
};
}
@ -436,7 +445,7 @@ export const musicappoint: EPR = async (info, data, send) => {
export const musicreg: EPR = async (info, data, send) => {
const version = GetVersion(info);
const refid = await IDtoRef(parseInt($(data).attr().iidxid));
const refid = await IDtoRef(Number($(data).attr().iidxid));
const shop_data = await DB.FindOne<shop_data>({
collection: "shop_data",
@ -446,12 +455,12 @@ export const musicreg: EPR = async (info, data, send) => {
});
// wid, oppid, opname, opt, opt2, pside, nocnt, anum //
const pgnum = parseInt($(data).attr().pgnum);
const gnum = parseInt($(data).attr().gnum);
const mnum = parseInt($(data).attr().mnum);
const cflg = parseInt($(data).attr().cflg);
let mid = parseInt($(data).attr().mid);
let clid = parseInt($(data).attr().clid);
const pgnum = Number($(data).attr().pgnum);
const gnum = Number($(data).attr().gnum);
const mnum = Number($(data).attr().mnum);
const cflg = Number($(data).attr().cflg);
let mid = Number($(data).attr().mid);
let clid = Number($(data).attr().clid);
let exscore = (pgnum * 2 + gnum);
let ghost = null, ghost_gauge = null; // Heroic Verse //
let style = 0, option = 0, option_2 = 0, rid = -1;
@ -487,20 +496,20 @@ export const musicreg: EPR = async (info, data, send) => {
let opt2Array = Array<number>(10).fill(0); // USED OPTION (CastHour) //
let update = 0;
if (!_.isNil($(data).attr().rid)) rid = parseInt($(data).attr().rid);
else if (!_.isNil($(data).attr().dj_level)) rid = parseInt($(data).attr().dj_level);
if (!_.isNil($(data).attr().rid)) rid = Number($(data).attr().rid);
else if (!_.isNil($(data).attr().dj_level)) rid = Number($(data).attr().dj_level);
if (rid > -1) console.log(`[music.reg] rank_id : ${rid}`);
if (version == 14 || version == 15) ghost = HextoBase64($(data).str("ghost"));
else ghost = NumArraytoBase64($(data).buffer("ghost"));
if (version < 16) ghost = Buffer.from($(data).str("ghost"), "hex").toString("base64");
else ghost = $(data).buffer("ghost").toString("base64");
if (version >= 27) {
ghost_gauge = NumArraytoBase64($(data).buffer("ghost_gauge"));
style = parseInt($(data).element("music_play_log").attr().play_style);
ghost_gauge = $(data).buffer("ghost_gauge").toString("base64");
style = Number($(data).element("music_play_log").attr().play_style);
if (version >= 29) {
option = parseInt($(data).element("music_play_log").attr().option1);
option_2 = parseInt($(data).element("music_play_log").attr().option2);
option = Number($(data).element("music_play_log").attr().option1);
option_2 = Number($(data).element("music_play_log").attr().option2);
}
}
@ -635,11 +644,11 @@ export const musicreg: EPR = async (info, data, send) => {
collection: "badge",
version: version,
category_name: "djLevel",
flg_id: parseInt($(data).attr("badge").djLevel_badge_flg_id),
flg_id: Number($(data).attr("badge").djLevel_badge_flg_id),
},
{
$set: {
flg: parseInt($(data).attr("badge").djLevel_badge_flg),
flg: Number($(data).attr("badge").djLevel_badge_flg),
}
}
);
@ -652,11 +661,11 @@ export const musicreg: EPR = async (info, data, send) => {
collection: "badge",
version: version,
category_name: "clear",
flg_id: parseInt($(data).attr("badge").clear_badge_flg_id),
flg_id: Number($(data).attr("badge").clear_badge_flg_id),
},
{
$set: {
flg: parseInt($(data).attr("badge").clear_badge_flg),
flg: Number($(data).attr("badge").clear_badge_flg),
}
}
);
@ -673,7 +682,7 @@ export const musicreg: EPR = async (info, data, send) => {
},
{
$set: {
flg: parseInt($(data).attr("badge").rivalChallenge_badge_flg),
flg: Number($(data).attr("badge").rivalChallenge_badge_flg),
}
}
);
@ -791,11 +800,11 @@ export const musicbreg: EPR = async (info, data, send) => {
const version = GetVersion(info);
// mid pgnum gnum cflg //
const refid = await IDtoRef(parseInt($(data).attr().iidxid));
const pgnum = parseInt($(data).attr().pgnum);
const gnum = parseInt($(data).attr().gnum);
const cflg = parseInt($(data).attr().cflg);
let mid = parseInt($(data).attr().mid);
const refid = await IDtoRef(Number($(data).attr().iidxid));
const pgnum = Number($(data).attr().pgnum);
const gnum = Number($(data).attr().gnum);
const cflg = Number($(data).attr().cflg);
let mid = Number($(data).attr().mid);
let clid = 0; // SP BEGINNER //
let exscore = (pgnum * 2 + gnum);
@ -879,7 +888,7 @@ export const musiccrate: EPR = async (info, data, send) => {
const scores = await DB.Find<score>(null, {
collection: "score",
});
const cltype = parseInt($(data).attr().cltype);
const cltype = Number($(data).attr().cltype);
let cFlgs: Record<number, number[]> = {},
fcFlgs: Record<number, number[]> = {},
@ -893,6 +902,8 @@ export const musiccrate: EPR = async (info, data, send) => {
let cFlgArray = Array<number>(10).fill(0);
let fcFlgArray = Array<number>(10).fill(0);
if (_.isNil(res.cArray)) throw new Error("[music.crate] There is unsupported entry in Database");
for (let a = 0; a < 10; a++) {
if (res.cArray[a] != 0) totalArray[a] += 1;
if (res.cArray[a] != 1) cFlgArray[a] += 1;
@ -924,10 +935,10 @@ export const musiccrate: EPR = async (info, data, send) => {
let indices = [1, 2, 3, 6, 7, 8];
if (version == 14 || version == 15) {
let verMid = OldMidToVerMid(parseInt(key));
let verMid = OldMidToVerMid(Number(key));
let str = cltype == 0 ?
`${NumArrayToString([7, 7, 7, 7], [verMid[1], cRate[1], cRate[2], cRate[3]])}ZZZZ`:
`${NumArrayToString([7, 7, 7, 7], [verMid[1], cRate[1], cRate[2], cRate[3]])}ZZZZ` :
`${NumArrayToString([7, 7, 7, 7], [verMid[1], cRate[6], cRate[7], cRate[8]])}ZZZZ`;
cdata.push(

View File

@ -1,7 +1,7 @@
import { pcdata, KDZ_pcdata, IIDX27_pcdata, IIDX28_pcdata, IIDX29_pcdata, IIDX30_pcdata, JDZ_pcdata, LDJ_pcdata, IIDX21_pcdata, IIDX22_pcdata, IIDX23_pcdata, IIDX24_pcdata, IIDX25_pcdata, IIDX26_pcdata, JDJ_pcdata, HDD_pcdata, I00_pcdata, GLD_pcdata, IIDX31_pcdata } from "../models/pcdata";
import { grade } from "../models/grade";
import { custom, default_custom } from "../models/custom";
import { IDtoCode, IDtoRef, Base64toNumArray, GetVersion, ReftoProfile, ReftoPcdata, ReftoQPRO, appendSettingConverter, NumArrayToString, NumArraytoHex, NumArraytoBase64 } from "../util";
import { IDtoCode, IDtoRef, GetVersion, ReftoProfile, ReftoPcdata, ReftoQPRO, appendSettingConverter, NumArrayToString } from "../util";
import { eisei_grade, eisei_grade_data, lightning_custom, lightning_musicfilter, lightning_musicmemo, lightning_musicmemo_new, lightning_playdata, lightning_settings, lm_customdata, lm_playdata, lm_settings, lm_settings_new, musicfilter_data, musicmemo_data, musicmemo_data_new } from "../models/lightning";
import { profile, default_profile } from "../models/profile";
import { rival, rival_data } from "../models/rival";
@ -121,7 +121,7 @@ export const pccommon: EPR = async (info, data, send) => {
result = {
...result,
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
pre_play: K.ATTR({ phase: String(U.GetConfig("pd_preplay")) }),
toho_remix: K.ATTR({ phase: String(U.GetConfig("pd_tohoremix")) }),
@ -144,7 +144,7 @@ export const pccommon: EPR = async (info, data, send) => {
result = {
...result,
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
boss: K.ATTR({ phase: String(U.GetConfig("cp_boss")) }),
event1_phase: K.ATTR({ phase: String(U.GetConfig("cp_event1")) }),
@ -167,7 +167,7 @@ export const pccommon: EPR = async (info, data, send) => {
result = {
...result,
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
boss: K.ATTR({ phase: String(U.GetConfig("sb_boss")) }),
extra_boss_event: K.ATTR({ phase: String(U.GetConfig("sb_extraboss")) }),
@ -184,7 +184,7 @@ export const pccommon: EPR = async (info, data, send) => {
result = {
...result,
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
boss: K.ATTR({ phase: String(U.GetConfig("cb_boss")) }),
event1_phase: K.ATTR({ phase: String(U.GetConfig("cb_event1")) }),
@ -200,7 +200,7 @@ export const pccommon: EPR = async (info, data, send) => {
result = {
...result,
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
boss: K.ATTR({ phase: String(U.GetConfig("rt_boss")) }),
extra_boss_event: K.ATTR({ phase: String(U.GetConfig("rt_extraboss")) }),
@ -221,7 +221,7 @@ export const pccommon: EPR = async (info, data, send) => {
...result,
movie_agreement: K.ATTR({ version: String(1) }),
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
boss: K.ATTR({ phase: String(U.GetConfig("hv_boss")) }),
vip_pass_black: {},
@ -244,7 +244,7 @@ export const pccommon: EPR = async (info, data, send) => {
...result,
movie_agreement: K.ATTR({ version: String(1) }),
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
movie_upload: K.ATTR({ url: String(U.GetConfig("MovieUpload")) }),
boss: K.ATTR({ phase: String(U.GetConfig("bo_boss")) }),
@ -271,7 +271,7 @@ export const pccommon: EPR = async (info, data, send) => {
...result,
movie_agreement: K.ATTR({ version: String(1) }),
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
movie_upload: K.ATTR({ url: String(U.GetConfig("MovieUpload")) }),
boss: K.ATTR({ phase: String(1) }), // TODO:: verify //
@ -299,7 +299,7 @@ export const pccommon: EPR = async (info, data, send) => {
...result,
movie_agreement: K.ATTR({ version: String(1) }),
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
movie_upload: K.ATTR({ url: String(U.GetConfig("MovieUpload")) }),
vip_pass_black: {},
@ -321,7 +321,7 @@ export const pccommon: EPR = async (info, data, send) => {
...result,
movie_agreement: K.ATTR({ version: String(1) }),
license: {
string: K.ITEM("bin", [0x00]), // TODO:: figure out what this does (alloc size: 600) //
string: K.ITEM("bin", Buffer.from([0x00])), // TODO:: figure out what this does (alloc size: 600) //
},
movie_upload: K.ATTR({ url: String(U.GetConfig("MovieUpload")) }),
vip_pass_black: {},
@ -574,6 +574,12 @@ export const pcget: EPR = async (info, data, send) => {
pcdata.dr_dppoint = IIDX29_pcdata.dr_dppoint;
}
// temporary solution until figure out why this happening on others //
if (_.isNil(pcdata.orb)) {
pcdata.orb = 0;
pcdata.present_orb = 0;
}
const appendsettings = appendSettingConverter(
custom.rank_folder,
custom.clear_folder,
@ -589,7 +595,7 @@ export const pcget: EPR = async (info, data, send) => {
custom.hide_iidxid,
custom.disable_beginner_option,
);
let dArray = [], eArray = [], rArray = [], mArray = [], bArray = [], fArray = [];
let dArray = [], eArray = [], rArray = [], mArray = [], bArray = [], fArray = [], fsArray = [];
grade.forEach((res: grade) => {
dArray.push([res.style, res.gradeId, res.maxStage, res.archive]);
@ -753,9 +759,9 @@ export const pcget: EPR = async (info, data, send) => {
event = await DB.FindOne(refid, { collection: "event_1", version: version });
if (!_.isNil(event)) {
event.cf = NumArraytoHex(Base64toNumArray(event.cf));
event.pf = NumArraytoHex(Base64toNumArray(event.pf));
event.mf = NumArraytoHex(Base64toNumArray(event.mf));
event.cf = Buffer.from(event.cf, "base64").toString("hex");
event.pf = Buffer.from(event.pf, "base64").toString("hex");
event.mf = Buffer.from(event.mf, "base64").toString("hex");
}
return send.pugFile("pug/JDZ/pcget.pug", {
@ -772,9 +778,9 @@ export const pcget: EPR = async (info, data, send) => {
event = await DB.FindOne(refid, { collection: "event_1", version: version });
if (!_.isNil(event)) {
event.cf = NumArraytoHex(Base64toNumArray(event.cf));
event.qcf = NumArraytoHex(Base64toNumArray(event.qcf));
event.piece = NumArraytoHex(Base64toNumArray(event.piece));
event.cf = Buffer.from(event.cf, "base64").toString("hex");
event.qcf = Buffer.from(event.qcf, "base64").toString("hex");
event.piece = Buffer.from(event.piece, "base64").toString("hex");
}
return send.pugFile("pug/KDZ/pcget.pug", {
@ -788,8 +794,8 @@ export const pcget: EPR = async (info, data, send) => {
});
}
else if (version == 20) {
pcdata.st_stamp = _.isNil(pcdata.st_stamp) ? "00" : NumArraytoHex(Base64toNumArray(pcdata.st_stamp));
pcdata.st_help = _.isNil(pcdata.st_help) ? "00" : NumArraytoHex(Base64toNumArray(pcdata.st_help));
pcdata.st_stamp = _.isNil(pcdata.st_stamp) ? "00" : Buffer.from(pcdata.st_stamp, "base64").toString("hex");
pcdata.st_help = _.isNil(pcdata.st_help) ? "00" : Buffer.from(pcdata.st_help, "base64").toString("hex");
let link5 = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "link5" });
let tricolettepark = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "tricolettepark" });
@ -797,7 +803,7 @@ export const pcget: EPR = async (info, data, send) => {
let blueboss = await DB.FindOne<blueboss>(refid, { collection: "event_1", version: version, event_name: "blueboss" });
let yellowboss = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "yellowboss" });
if (!_.isNil(blueboss)) blueboss.durability = NumArraytoHex(Base64toNumArray(blueboss.durability));
if (!_.isNil(blueboss)) blueboss.durability = Buffer.from(blueboss.durability, "base64").toString("hex");
return send.pugFile("pug/LDJ/pcget.pug", {
profile,
@ -835,6 +841,7 @@ export const pcget: EPR = async (info, data, send) => {
mirage_lib_sub = [],
delabity_lab = null,
delabity_lab_sub = [],
anniv20 = null,
epo_res = null,
epo_res_sub = [],
event_1 = null,
@ -843,16 +850,16 @@ export const pcget: EPR = async (info, data, send) => {
switch (version) {
case 21:
pcdata.st_album = _.isNil(pcdata.st_album) ? "00" : NumArraytoHex(Base64toNumArray(pcdata.st_album));
pcdata.st_album = _.isNil(pcdata.st_album) ? "00" : Buffer.from(pcdata.st_album, "base64").toString("hex");
link5 = await DB.FindOne(refid, { collection: "event_1", version: 20, event_name: "link5" });
tricolettepark = await DB.FindOne(refid, { collection: "event_1", version: 20, event_name: "tricolettepark" });
boss1 = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "boss1" });
if (!_.isNil(boss1)) boss1.durability = NumArraytoHex(Base64toNumArray(boss1.durability));
if (!_.isNil(boss1)) boss1.durability = Buffer.from(boss1.durability, "base64").toString("hex");
break;
case 22:
pcdata.st_album = _.isNil(pcdata.st_album) ? "00" : NumArraytoHex(Base64toNumArray(pcdata.st_album));
pcdata.st_album = _.isNil(pcdata.st_album) ? "00" : Buffer.from(pcdata.st_album, "base64").toString("hex");
chrono_diver = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "chrono_diver" });
pendual_talis = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "boss_event_3" });
@ -864,7 +871,7 @@ export const pcget: EPR = async (info, data, send) => {
qpronicle_phase3 = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "qpronicle_phase3" });
break;
case 23:
pcdata.st_tokimeki = _.isNil(pcdata.st_tokimeki) ? "00" : NumArraytoHex(Base64toNumArray(pcdata.st_tokimeki));
pcdata.st_tokimeki = _.isNil(pcdata.st_tokimeki) ? "00" : Buffer.from(pcdata.st_tokimeki, "base64").toString("hex");
open_tokotoko = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "event1_data" });
mystery_line = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "event2_data" });
@ -875,16 +882,16 @@ export const pcget: EPR = async (info, data, send) => {
siege_sinobuz_sub = await DB.Find(refid, { collection: "event_1_sub", version: version, event_name: "event1_data" });
siege_sinobuz_sub.forEach((res) => {
res.is_clear = Number(res.is_clear);
res.ninjyutsu = NumArraytoHex(Base64toNumArray(res.ninjyutsu));
res.card_damage = NumArraytoHex(Base64toNumArray(res.card_damage));
res.card_clear = NumArraytoHex(Base64toNumArray(res.card_clear));
res.ninjyutsu = Buffer.from(res.ninjyutsu, "base64").toString("hex");
res.card_damage = Buffer.from(res.card_damage, "base64").toString("hex");
res.card_clear = Buffer.from(res.card_clear, "base64").toString("hex");
});
ninja_shichikyoden = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "event2_data" });
if (!_.isNil(ninja_shichikyoden))
ninja_shichikyoden.last_select_dojo = NumArraytoHex(Base64toNumArray(ninja_shichikyoden.last_select_dojo));
ninja_shichikyoden.last_select_dojo = Buffer.from(ninja_shichikyoden.last_select_dojo, "base64").toString("hex");
if (!_.isNil(ninja_shichikyoden))
ninja_shichikyoden.enemy_damage = NumArraytoHex(Base64toNumArray(ninja_shichikyoden.enemy_damage));
ninja_shichikyoden.enemy_damage = Buffer.from(ninja_shichikyoden.enemy_damage, "base64").toString("hex");
break;
case 25:
rush_cannonracer = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "event1_data" });
@ -896,15 +903,17 @@ export const pcget: EPR = async (info, data, send) => {
case 26:
mirage_lib = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "event1_data" });
if (!_.isNil(mirage_lib))
mirage_lib.quiz_control_list = NumArraytoHex(Base64toNumArray(mirage_lib.quiz_control_list));
mirage_lib.quiz_control_list = Buffer.from(mirage_lib.quiz_control_list, "base64").toString("hex");
mirage_lib_sub = await DB.Find(refid, { collection: "event_1_sub", version: version, event_name: "event1_data" });
mirage_lib_sub.forEach((res) => {
res.map_route_damage = NumArraytoHex(Base64toNumArray(res.map_route_damage));
res.map_route_damage = Buffer.from(res.map_route_damage, "base64").toString("hex");
});
delabity_lab = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "event2_data" });
delabity_lab_sub = await DB.Find(refid, { collection: "event_1_sub", version: version, event_name: "event2_data" });
anniv20 = await DB.FindOne(refid, { collection: "event_1", version: version, event_name: "anniv20_data" });
break;
case 31:
let myepo_map = await DB.Find(refid, { collection: "event_1", version: version, event_data: "myepo_map" });
@ -946,10 +955,10 @@ export const pcget: EPR = async (info, data, send) => {
}
if (!_.isNil(pcdata.sp_mlist)) {
pcdata.sp_mlist = NumArraytoHex(Base64toNumArray(pcdata.sp_mlist));
pcdata.sp_clist = NumArraytoHex(Base64toNumArray(pcdata.sp_clist));
pcdata.dp_mlist = NumArraytoHex(Base64toNumArray(pcdata.dp_mlist));
pcdata.dp_clist = NumArraytoHex(Base64toNumArray(pcdata.dp_clist));
pcdata.sp_mlist = Buffer.from(pcdata.sp_mlist, "base64").toString("hex");
pcdata.sp_clist = Buffer.from(pcdata.sp_clist, "base64").toString("hex");
pcdata.dp_mlist = Buffer.from(pcdata.dp_mlist, "base64").toString("hex");
pcdata.dp_clist = Buffer.from(pcdata.dp_clist, "base64").toString("hex");
}
if (version >= 30) {
@ -1181,48 +1190,113 @@ export const pcget: EPR = async (info, data, send) => {
bArray.sort((a, b) => a.id - b.id || a.flg_id - b.flg_id);
}
return send.pugFile(`pug/LDJ/${version}pcget.pug`, {
let result: any = {
profile,
pcdata,
lm_playdata,
lm_settings,
lm_custom,
mArray,
dArray,
eArray,
fArray,
appendsettings,
custom,
rArray,
evtArray,
evtArray2,
evtArray3,
boss1,
shop_data,
};
switch (version) {
case 21:
result = {
...result,
link5,
tricolettepark,
boss1,
};
break;
case 22:
result = {
...result,
chrono_diver,
qpronicle_chord,
qpronicle_chord_sub,
qpronicle_phase3,
pendual_talis,
};
break;
case 23:
result = {
...result,
open_tokotoko,
mystery_line,
mystery_line_sub,
};
break;
case 24:
result = {
...result,
siege_sinobuz,
siege_sinobuz_sub,
ninja_shichikyoden,
};
break;
case 25:
result = {
...result,
rush_cannonracer,
rush_cannonracer_sub,
};
break;
case 26:
result = {
...result,
mirage_lib,
mirage_lib_sub,
delabity_lab,
delabity_lab_sub,
anniv20,
};
break;
case 31:
result = {
...result,
epo_res,
epo_res_sub,
wArray,
};
break;
default:
break;
}
switch (version) {
case 31:
result = {
...result,
fArray,
};
case 30:
result = {
...result,
bArray,
shop_data,
});
};
case 29:
case 28:
result = {
...result,
mArray,
wArray,
};
case 27:
result = {
...result,
lm_playdata,
lm_settings,
lm_custom,
eArray,
evtArray,
evtArray2,
evtArray3,
};
default: break;
}
return send.pugFile(`pug/LDJ/${version}pcget.pug`, result);
}
return send.deny();
@ -1802,8 +1876,8 @@ export const pcsave: EPR = async (info, data, send) => {
pcdata.st_dp_mplay = parseInt($(data).attr("step").dp_mplay);
}
pcdata.st_review = parseInt($(data).attr("step").review);
pcdata.st_stamp = NumArraytoBase64($(data).buffer("step")); // TODO:: verify //
pcdata.st_help = NumArraytoBase64($(data).element("step").buffer("help"));
pcdata.st_stamp = $(data).buffer("step").toString("base64"); // TODO:: verify //
pcdata.st_help = $(data).element("step").buffer("help").toString("base64");
}
if (!_.isNil($(data).element("achievements"))) {
@ -2080,10 +2154,10 @@ export const pcsave: EPR = async (info, data, send) => {
}
if (!_.isNil($(data).element("favorite"))) {
pcdata.sp_mlist = NumArraytoBase64($(data).element("favorite").buffer("sp_mlist"));
pcdata.sp_clist = NumArraytoBase64($(data).element("favorite").buffer("sp_clist"));
pcdata.dp_mlist = NumArraytoBase64($(data).element("favorite").buffer("dp_mlist"));
pcdata.dp_clist = NumArraytoBase64($(data).element("favorite").buffer("dp_clist"));
pcdata.sp_mlist = $(data).element("favorite").buffer("sp_mlist").toString("base64");
pcdata.sp_clist = $(data).element("favorite").buffer("sp_clist").toString("base64");
pcdata.dp_mlist = $(data).element("favorite").buffer("dp_mlist").toString("base64");
pcdata.dp_clist = $(data).element("favorite").buffer("dp_clist").toString("base64");
}
if (!_.isNil($(data).element("qpro_secret"))) {
@ -2115,7 +2189,7 @@ export const pcsave: EPR = async (info, data, send) => {
pcdata.st_sp_mplay = parseInt($(data).attr("step").sp_mplay);
pcdata.st_dp_mplay = parseInt($(data).attr("step").dp_mplay);
pcdata.st_last_select = parseInt($(data).attr("step").last_select);
pcdata.st_album = NumArraytoBase64($(data).buffer("step")); // TODO:: verify //
pcdata.st_album = $(data).buffer("step").toString("base64"); // TODO:: verify //
}
if (!_.isNil($(data).element("deller"))) pcdata.deller += parseInt($(data).attr("deller").deller);
@ -2345,10 +2419,10 @@ export const pcsave: EPR = async (info, data, send) => {
}
if (!_.isNil($(data).element("favorite"))) {
pcdata.sp_mlist = NumArraytoBase64($(data).element("favorite").buffer("sp_mlist"));
pcdata.sp_clist = NumArraytoBase64($(data).element("favorite").buffer("sp_clist"));
pcdata.dp_mlist = NumArraytoBase64($(data).element("favorite").buffer("dp_mlist"));
pcdata.dp_clist = NumArraytoBase64($(data).element("favorite").buffer("dp_clist"));
pcdata.sp_mlist = $(data).element("favorite").buffer("sp_mlist").toString("base64");
pcdata.sp_clist = $(data).element("favorite").buffer("sp_clist").toString("base64");
pcdata.dp_mlist = $(data).element("favorite").buffer("dp_mlist").toString("base64");
pcdata.dp_clist = $(data).element("favorite").buffer("dp_clist").toString("base64");
}
if (!_.isNil($(data).element("qpro_secret"))) {
@ -2388,7 +2462,7 @@ export const pcsave: EPR = async (info, data, send) => {
pcdata.st_sp_mplay = parseInt($(data).attr("step").sp_mplay);
pcdata.st_dp_mplay = parseInt($(data).attr("step").dp_mplay);
pcdata.st_age_list = parseInt($(data).attr("step").age_list);
pcdata.st_album = NumArraytoBase64($(data).buffer("step")); // TODO:: verify //
pcdata.st_album = $(data).buffer("step").toString("base64"); // TODO:: verify //
pcdata.st_is_present = parseInt($(data).attr("step").is_present);
pcdata.st_is_future = parseInt($(data).attr("step").is_future);
}
@ -2581,10 +2655,10 @@ export const pcsave: EPR = async (info, data, send) => {
}
if (!_.isNil($(data).element("favorite"))) {
pcdata.sp_mlist = NumArraytoBase64($(data).element("favorite").buffer("sp_mlist"));
pcdata.sp_clist = NumArraytoBase64($(data).element("favorite").buffer("sp_clist"));
pcdata.dp_mlist = NumArraytoBase64($(data).element("favorite").buffer("dp_mlist"));
pcdata.dp_clist = NumArraytoBase64($(data).element("favorite").buffer("dp_clist"));
pcdata.sp_mlist = $(data).element("favorite").buffer("sp_mlist").toString("base64");
pcdata.sp_clist = $(data).element("favorite").buffer("sp_clist").toString("base64");
pcdata.dp_mlist = $(data).element("favorite").buffer("dp_mlist").toString("base64");
pcdata.dp_clist = $(data).element("favorite").buffer("dp_clist").toString("base64");
}
if (!_.isNil($(data).element("qpro_secret"))) {
@ -2624,7 +2698,7 @@ export const pcsave: EPR = async (info, data, send) => {
pcdata.st_sp_mplay = parseInt($(data).attr("step").sp_mplay);
pcdata.st_dp_mplay = parseInt($(data).attr("step").dp_mplay);
pcdata.st_mission_gauge = parseInt($(data).attr("step").mission_gauge);
pcdata.st_tokimeki = NumArraytoBase64($(data).buffer("step")); // TODO:: verify //
pcdata.st_tokimeki = $(data).buffer("step").toString("base64"); // TODO:: verify //
}
if (!_.isNil($(data).element("deller"))) pcdata.deller += parseInt($(data).attr("deller").deller);
@ -2751,10 +2825,10 @@ export const pcsave: EPR = async (info, data, send) => {
}
if (!_.isNil($(data).element("favorite"))) {
pcdata.sp_mlist = NumArraytoBase64($(data).element("favorite").buffer("sp_mlist"));
pcdata.sp_clist = NumArraytoBase64($(data).element("favorite").buffer("sp_clist"));
pcdata.dp_mlist = NumArraytoBase64($(data).element("favorite").buffer("dp_mlist"));
pcdata.dp_clist = NumArraytoBase64($(data).element("favorite").buffer("dp_clist"));
pcdata.sp_mlist = $(data).element("favorite").buffer("sp_mlist").toString("base64");
pcdata.sp_clist = $(data).element("favorite").buffer("sp_clist").toString("base64");
pcdata.dp_mlist = $(data).element("favorite").buffer("dp_mlist").toString("base64");
pcdata.dp_clist = $(data).element("favorite").buffer("dp_clist").toString("base64");
}
if (!_.isNil($(data).element("qpro_secret"))) {
@ -2938,10 +3012,10 @@ export const pcsave: EPR = async (info, data, send) => {
}
if (!_.isNil($(data).element("favorite"))) {
pcdata.sp_mlist = NumArraytoBase64($(data).element("favorite").buffer("sp_mlist"));
pcdata.sp_clist = NumArraytoBase64($(data).element("favorite").buffer("sp_clist"));
pcdata.dp_mlist = NumArraytoBase64($(data).element("favorite").buffer("dp_mlist"));
pcdata.dp_clist = NumArraytoBase64($(data).element("favorite").buffer("dp_clist"));
pcdata.sp_mlist = $(data).element("favorite").buffer("sp_mlist").toString("base64");
pcdata.sp_clist = $(data).element("favorite").buffer("sp_clist").toString("base64");
pcdata.dp_mlist = $(data).element("favorite").buffer("dp_mlist").toString("base64");
pcdata.dp_clist = $(data).element("favorite").buffer("dp_clist").toString("base64");
}
if (!_.isNil($(data).element("qpro_secret"))) {
@ -3109,10 +3183,10 @@ export const pcsave: EPR = async (info, data, send) => {
}
if (!_.isNil($(data).element("favorite"))) {
pcdata.sp_mlist = NumArraytoBase64($(data).element("favorite").buffer("sp_mlist"));
pcdata.sp_clist = NumArraytoBase64($(data).element("favorite").buffer("sp_clist"));
pcdata.dp_mlist = NumArraytoBase64($(data).element("favorite").buffer("dp_mlist"));
pcdata.dp_clist = NumArraytoBase64($(data).element("favorite").buffer("dp_clist"));
pcdata.sp_mlist = $(data).element("favorite").buffer("sp_mlist").toString("base64");
pcdata.sp_clist = $(data).element("favorite").buffer("sp_clist").toString("base64");
pcdata.dp_mlist = $(data).element("favorite").buffer("dp_mlist").toString("base64");
pcdata.dp_clist = $(data).element("favorite").buffer("dp_clist").toString("base64");
}
if (!_.isNil($(data).element("qpro_secret"))) {
@ -3143,12 +3217,12 @@ export const pcsave: EPR = async (info, data, send) => {
pcdata.st_dp_dj_mission_level = parseInt($(data).attr("step").dp_dj_mission_level);
pcdata.st_sp_clear_mission_level = parseInt($(data).attr("step").sp_clear_mission_level);
pcdata.st_dp_clear_mission_level = parseInt($(data).attr("step").dp_clear_mission_level);
pcdata.st_sp_dj_mission_clear = parseInt($(data).attr("step").dp_clear_mission_level);
pcdata.st_dp_dj_mission_clear = parseInt($(data).attr("step").dp_clear_mission_level);
pcdata.st_sp_clear_mission_clear = parseInt($(data).attr("step").dp_clear_mission_level);
pcdata.st_dp_clear_mission_clear = parseInt($(data).attr("step").dp_clear_mission_level);
pcdata.st_sp_mplay = parseInt($(data).attr("step").dp_clear_mission_level);
pcdata.st_dp_mplay = parseInt($(data).attr("step").dp_clear_mission_level);
pcdata.st_sp_dj_mission_clear = parseInt($(data).attr("step").sp_dj_mission_clear);
pcdata.st_dp_dj_mission_clear = parseInt($(data).attr("step").dp_dj_mission_clear);
pcdata.st_sp_clear_mission_clear = parseInt($(data).attr("step").sp_clear_mission_clear);
pcdata.st_dp_clear_mission_clear = parseInt($(data).attr("step").dp_clear_mission_clear);
pcdata.st_sp_mplay = parseInt($(data).attr("step").sp_mplay);
pcdata.st_dp_mplay = parseInt($(data).attr("step").dp_mplay);
pcdata.st_tips_read_list = parseInt($(data).attr("step").tips_read_list);
}
@ -3194,7 +3268,7 @@ export const pcsave: EPR = async (info, data, send) => {
pcdata.present_orb += parseInt($(data).attr("orb_data").present_orb);
}
// skin_customize_flg (attr: skin_frame_flg, skin_bgm_flg) //
// skin_customize_flg (attr: skin_frame_flg, skin_bgm_flg, ...) //
// TODO:: fix event saving, these event savings hasn't fully tested //
if (hasEventData) {
@ -3486,10 +3560,11 @@ export const pcsave: EPR = async (info, data, send) => {
if (!_.isNil($(data).element("deller"))) pcdata.deller += parseInt($(data).attr("deller").deller);
if (!_.isNil($(data).element("orb_data"))) {
if (version == 31) {
if (version >= 31) {
pcdata.orb += parseInt($(data).attr("orb_data").add_orb_normal);
pcdata.orb += parseInt($(data).attr("orb_data").add_orb_event);
pcdata.present_orb += parseInt($(data).attr("orb_data").rest_orb);
// use_present_orb //
}
else {
pcdata.orb += parseInt($(data).attr("orb_data").add_orb);
@ -3947,7 +4022,8 @@ export const pcsave: EPR = async (info, data, send) => {
let badge_data = [];
let badge = $(data).element("badge");
if (version == 30) {
switch (version) {
case 30:
if (!(_.isNil(badge.element("today_recommend")))) {
let badgeInfo = {
category_id: "today_recommend",
@ -4035,8 +4111,8 @@ export const pcsave: EPR = async (info, data, send) => {
badge_data.push(badgeInfo);
}
}
else if (version == 31) {
break;
case 31:
if (!(_.isNil(badge.element("step_up")))) {
badge.elements("step_up").forEach((res) => {
let badgeInfo = {
@ -4158,6 +4234,10 @@ export const pcsave: EPR = async (info, data, send) => {
badge_data.push(badgeInfo);
});
}
break;
default:
break;
}
badge_data.forEach((res) => {
@ -4345,19 +4425,13 @@ export const pcgetlanegacha: EPR = async (info, data, send) => {
);
}
// settings(sp, dp_left, dp_right), info(last_page) //
return send.object({
ticket: tArray,
settings: K.ATTR({
sp: String(-1),
dp_left: String(-1),
dp_right: String(-1),
}),
free: K.ATTR({
num: String(10),
}),
info: K.ATTR({
last_page: String(0),
}),
});
};

View File

@ -40,97 +40,6 @@ export function ClidToPlaySide(clid: number) {
return clid < 5 ? 0 : 1;
}
export function NumArraytoBase64(buff: number[]) {
const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
let result = "";
for (let i = 0; i < buff.length; i += 3) {
const chunk = (buff[i] << 16) | (buff[i + 1] << 8) | buff[i + 2];
result += base64Chars[(chunk >> 18) & 63] +
base64Chars[(chunk >> 12) & 63] +
base64Chars[(chunk >> 6) & 63] +
base64Chars[chunk & 63];
}
const padding = buff.length % 3;
if (padding === 1) {
result = result.slice(0, -2) + "==";
} else if (padding === 2) {
result = result.slice(0, -1) + "=";
}
return result;
}
export function Base64toNumArray(s: string) {
const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
let p = -8,
a = 0,
c: number,
d: number,
buffer: number[] = [];
if (_.isNil(s)) return buffer;
for (let i = 0; i < s.length; i++) {
if ((c = base64Chars.indexOf(s.charAt(i))) < 0) continue;
a = (a << 6) | (c & 63);
if ((p += 6) >= 0) {
d = (a >> p) & 255;
if (c !== 64) buffer.push(d);
a &= 63;
p -= 8;
}
}
return buffer;
}
export function NumArraytoHex(buff: number[]) {
let hexStr = "";
for (let i = 0; i < buff.length; i++) {
const hex = buff[i].toString(16);
const paddedHex = hex.length % 2 ? "0" + hex : hex;
hexStr += paddedHex;
}
return hexStr;
}
export function HextoBase64(hex: string) {
const buffer = [];
const base64Chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
let base64String = "";
let i = 0;
for (let i = 0; i < hex.length; i += 2) {
const hexByte = hex.slice(i, i + 2);
const byteValue = parseInt(hexByte, 16);
buffer.push(byteValue);
}
while (i < buffer.length) {
const byte1 = buffer[i++] || 0;
const byte2 = buffer[i++] || 0;
const byte3 = buffer[i++] || 0;
const enc1 = byte1 >> 2;
const enc2 = ((byte1 & 3) << 4) | (byte2 >> 4);
const enc3 = ((byte2 & 15) << 2) | (byte3 >> 6);
const enc4 = byte3 & 63;
base64String +=
base64Chars.charAt(enc1) +
base64Chars.charAt(enc2) +
(i <= buffer.length + 2 ? base64Chars.charAt(enc3) : "=") +
(i <= buffer.length + 1 ? base64Chars.charAt(enc4) : "=");
}
return base64String;
}
export function NumArrayToString(bits: number[], numArray: number[]): string {
const characters = "0123456789:;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
let byteSum = 0;
@ -306,8 +215,7 @@ export async function ReftoQPRO(refid: string, version: number) {
let qpro_data = [];
try {
switch (version) {
case 31:
if (version >= 31) {
qpro_data = [
custom.qpro_hair,
custom.qpro_head,
@ -316,8 +224,8 @@ export async function ReftoQPRO(refid: string, version: number) {
custom.qpro_hand,
custom.qpro_back,
];
break;
default:
}
else {
qpro_data = [
custom.qpro_hair,
custom.qpro_head,
@ -325,7 +233,6 @@ export async function ReftoQPRO(refid: string, version: number) {
custom.qpro_body,
custom.qpro_hand,
];
break;
}
} catch {
qpro_data = [0, 0, 0, 0, 0, 0];