From 8a9683589b1e186febb88cdf5ed26f03a4afb945 Mon Sep 17 00:00:00 2001 From: duel0213 Date: Wed, 28 Feb 2024 09:15:46 +0900 Subject: [PATCH] IIDX: Initial support added for EMPRESS --- iidx@asphyxia/README.md | 5 +- iidx@asphyxia/handlers/music.ts | 6 ++- iidx@asphyxia/handlers/pc.ts | 83 ++++++++++++++++++++++++++++++- iidx@asphyxia/handlers/ranking.ts | 4 +- iidx@asphyxia/handlers/shop.ts | 4 +- iidx@asphyxia/index.ts | 1 + iidx@asphyxia/models/pcdata.ts | 31 ++++++++++++ iidx@asphyxia/pug/I00/pcget.pug | 17 +++++++ iidx@asphyxia/util.ts | 1 + 9 files changed, 143 insertions(+), 9 deletions(-) create mode 100644 iidx@asphyxia/pug/I00/pcget.pug diff --git a/iidx@asphyxia/README.md b/iidx@asphyxia/README.md index c592811..b237c1e 100644 --- a/iidx@asphyxia/README.md +++ b/iidx@asphyxia/README.md @@ -7,6 +7,7 @@ Plugin Version: **v0.1.13** Supported Versions - beatmaniaIIDX 15 DJ TROOPERS + - beatmaniaIIDX 16 EMPRESS - beatmaniaIIDX 17 SIRIUS - beatmaniaIIDX 18 Resort Anthem - beatmaniaIIDX 19 Lincle @@ -36,8 +37,8 @@ Features --- Known Issues - - Clear Lamps may display invalid lamps due to missing conversion code + - DJ LEVEL folders are broken in ~ DJ TROOPERS due to missing rank_id - LEGGENDARIA play records before HEROIC VERSE may not display on higher version due to missing conversion code --- @@ -119,3 +120,5 @@ Changelogs **v0.1.13** - Added Initial support for DJ TROOPERS + - Added Initial support for EMPRESS + - Fixed where EXPERT result does not display total cleared users and ranking position diff --git a/iidx@asphyxia/handlers/music.ts b/iidx@asphyxia/handlers/music.ts index 9262645..fe82e10 100644 --- a/iidx@asphyxia/handlers/music.ts +++ b/iidx@asphyxia/handlers/music.ts @@ -81,7 +81,8 @@ export const musicgetrank: EPR = async (info, data, send) => { let mVersion = Math.floor(temp_mid / 100); if (mVersion > version) return; - score_data = [-1, temp_mid, ...indices.map(i => res.cArray[i]), ...indices.map(i => res.esArray[i]), ...indices.map(i => res.mArray[i])]; + if (version == 16) score_data = [-1, temp_mid, ...indices.map(i => res.cArray[i]), ...indices.map(i => res.esArray[i])]; + else score_data = [-1, temp_mid, ...indices.map(i => res.cArray[i]), ...indices.map(i => res.esArray[i]), ...indices.map(i => res.mArray[i])]; m.push(K.ARRAY("s16", score_data)); if (res.cArray[0] != 0) b.push(K.ARRAY("u16", [temp_mid, res.cArray[0]])); @@ -99,7 +100,8 @@ export const musicgetrank: EPR = async (info, data, send) => { let mVersion = Math.floor(temp_mid / 100); if (mVersion > version) return; - score_data = [i, temp_mid, ...indices.map(i => res.cArray[i]), ...indices.map(i => res.esArray[i]), ...indices.map(i => res.mArray[i])]; + if (version == 16) score_data = [i, temp_mid, ...indices.map(i => res.cArray[i]), ...indices.map(i => res.esArray[i])]; + else score_data = [i, temp_mid, ...indices.map(i => res.cArray[i]), ...indices.map(i => res.esArray[i]), ...indices.map(i => res.mArray[i])]; m.push(K.ARRAY("s16", score_data)); }); diff --git a/iidx@asphyxia/handlers/pc.ts b/iidx@asphyxia/handlers/pc.ts index e825258..1c897e8 100644 --- a/iidx@asphyxia/handlers/pc.ts +++ b/iidx@asphyxia/handlers/pc.ts @@ -1,4 +1,4 @@ -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 } from "../models/pcdata"; +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 } from "../models/pcdata"; import { grade } from "../models/grade"; import { custom, default_custom } from "../models/custom"; import { IDtoCode, IDtoRef, Base64toBuffer, GetVersion, ReftoProfile, ReftoPcdata, ReftoQPRO, appendSettingConverter, NumArrayToString } from "../util"; @@ -24,6 +24,18 @@ export const pccommon: EPR = async (info, data, send) => { // exposing these to plugin setting or use static value // switch (version) { case 15: + case 16: + result = { + ...result, + cmd: K.ATTR({ + gmbl: String(Number(U.GetConfig("cmd_gmbl"))), + gmbla: String(Number(U.GetConfig("cmd_gmbla"))), + regl: String(Number(U.GetConfig("cmd_regl"))), + rndp: String(Number(U.GetConfig("cmd_rndp"))), + hrnd: String(Number(U.GetConfig("cmd_hrnd"))), + alls: String(Number(U.GetConfig("cmd_alls"))), + }), + } break; case 17: result = { @@ -244,6 +256,9 @@ export const pcreg: EPR = async (info, data, send) => { case 15: pcdata = HDD_pcdata; break; + case 16: + pcdata = I00_pcdata; + break; case 17: pcdata = JDJ_pcdata; break; @@ -485,7 +500,25 @@ export const pcget: EPR = async (info, data, send) => { rArray, }); } - if (version == 17) { + else if (version == 16) { + expert.sort((a: expert, b: expert) => a.coid - b.coid); + expert.forEach((res) => { + for (let a = 0; a < 6; a++) { + eArray.push([res.coid, a, res.cArray[a], res.pgArray[a], res.gArray[a]]); + } + }); + + return send.pugFile("pug/I00/pcget.pug", { + profile, + pcdata, + dArray, + eArray, + appendsettings, + custom, + rArray, + }); + } + else if (version == 17) { expert.sort((a: expert, b: expert) => a.coid - b.coid); expert.forEach((res) => { for (let a = 0; a < 6; a++) { @@ -803,6 +836,9 @@ export const pctakeover: EPR = async (info, data, send) => { case 15: pcdata = HDD_pcdata; break; + case 16: + pcdata = I00_pcdata; + break; case 17: pcdata = JDJ_pcdata; break; @@ -1004,6 +1040,49 @@ export const pcsave: EPR = async (info, data, send) => { ); } } + else if (version == 16) { + if (cltype == 0) { + pcdata.sach = parseInt($(data).attr().achi); + pcdata.sp_opt = parseInt($(data).attr().opt); + } + else { + pcdata.dach = parseInt($(data).attr().achi); + pcdata.dp_opt = parseInt($(data).attr().opt); + pcdata.dp_opt2 = parseInt($(data).attr().opt2); + } + + pcdata.gno = parseInt($(data).attr().gno); + pcdata.sflg0 = parseInt($(data).attr().sflg0); + pcdata.sflg1 = parseInt($(data).attr().sflg1); + pcdata.sflg2 = parseInt($(data).attr().sflg2); + pcdata.sdhd = parseInt($(data).attr().sdhd); + pcdata.ncomb = parseInt($(data).attr().ncomb); + pcdata.mcomb = parseInt($(data).attr().mcomb); + pcdata.liflen = parseInt($(data).attr().lift); + pcdata.fcombo[cltype] = parseInt($(data).attr().fcombo); + + if (!_.isNil($(data).element("tutorial"))) { + let clr = parseInt($(data).attr("tutorial").clr); + await DB.Upsert(refid, + { + collection: "tutorial", + version: version, + tid: parseInt($(data).attr("tutorial").tid), + }, + { + $set: { + clr + } + } + ); + } + + // bigint is returning convert error on sendPug so save as string // + if (!_.isNil($(data).element("jewel"))) { + pcdata.jewel_num = String($(data).element("jewel").bigint("jnum")); + pcdata.jewel_bnum = $(data).element("jewel").numbers("bjnum"); + } + } else if (version == 17) { if (cltype == 0) { pcdata.sach = parseInt($(data).attr().achi); diff --git a/iidx@asphyxia/handlers/ranking.ts b/iidx@asphyxia/handlers/ranking.ts index b97bc5b..46748c9 100644 --- a/iidx@asphyxia/handlers/ranking.ts +++ b/iidx@asphyxia/handlers/ranking.ts @@ -106,7 +106,7 @@ export const rankingentry: EPR = async (info, data, send) => { } ); - let expertUser = await DB.Find(null, { + let expertUser = await DB.Find({ collection: "ranking", version: version, coid: coid, @@ -143,7 +143,7 @@ export const rankingoentry: EPR = async (info, data, send) => { export const rankinggetranker: EPR = async (info, data, send) => { const version = GetVersion(info); - const ranking = await DB.Find(null, { + const ranking = await DB.Find({ collection: "ranking", version: version, coid: parseInt($(data).attr().coid), diff --git a/iidx@asphyxia/handlers/shop.ts b/iidx@asphyxia/handlers/shop.ts index 615024e..7388272 100644 --- a/iidx@asphyxia/handlers/shop.ts +++ b/iidx@asphyxia/handlers/shop.ts @@ -11,14 +11,14 @@ export const shopgetname: EPR = async (info, data, send) => { collection: "shop_data", opname: "CORE", - pid: 57, + pid: 53, cls_opt: 0, }); return send.object( K.ATTR({ opname: "CORE", - pid: "57", + pid: "53", cls_opt: "0", hr: "0", mi: "0", diff --git a/iidx@asphyxia/index.ts b/iidx@asphyxia/index.ts index fc6d142..a2b846e 100644 --- a/iidx@asphyxia/index.ts +++ b/iidx@asphyxia/index.ts @@ -16,6 +16,7 @@ export function register() { R.Contributor("duel0213"); R.GameCode("HDD"); + R.GameCode("I00"); R.GameCode("JDJ"); R.GameCode("JDZ"); R.GameCode("KDZ"); diff --git a/iidx@asphyxia/models/pcdata.ts b/iidx@asphyxia/models/pcdata.ts index 612813c..064c11c 100644 --- a/iidx@asphyxia/models/pcdata.ts +++ b/iidx@asphyxia/models/pcdata.ts @@ -120,6 +120,8 @@ export interface pcdata { sgid: number; // grade // dgid: number; + jewel_num: string; + jewel_bnum: number[]; party: number[]; jpoint: number; // jpoint (lincle) // @@ -239,6 +241,35 @@ export const HDD_pcdata = { dgid: -1, } +export const I00_pcdata = { + version: 16, + + spnum: 0, + dpnum: 0, + sach: 0, + dach: 0, + sflg0: 0, + sflg1: 0, + sflg2: 0, + gno: 0, + sdhd: 0, + sp_opt: 0, + dp_opt: 0, + dp_opt2: 0, + mcomb: 0, + ncomb: 0, + mode: 0, + pmode: 0, + liflen: 0, + + jewel_num: "0", + jewel_bnum: Array(18).fill(0), + fcombo: Array(2).fill(0), + + sgid: -1, + dgid: -1, +} + export const JDJ_pcdata = { version: 17, diff --git a/iidx@asphyxia/pug/I00/pcget.pug b/iidx@asphyxia/pug/I00/pcget.pug new file mode 100644 index 0000000..8f19393 --- /dev/null +++ b/iidx@asphyxia/pug/I00/pcget.pug @@ -0,0 +1,17 @@ +pc(status="0") + pcdata(id=profile.id idstr=profile.idstr name=profile.name pid=profile.pid spnum=pcdata.spnum dpnum=pcdata.dpnum sach=pcdata.sach dach=pcdata.dach sflg0=pcdata.sflg0 sflg1=pcdata.sflg1 sflg2=pcdata.sflg2 gno=pcdata.gno sdhd=pcdata.sdhd sp_opt=pcdata.sp_opt dp_opt=pcdata.dp_opt dp_opt2=pcdata.dp_opt2 mcomb=pcdata.mcomb ncomb=pcdata.ncomb mode=pcdata.mode pmode=pcdata.pmode lift_len=pcdata.liflen) + grade(sgid=pcdata.sgid dgid=pcdata.dgid) + - for (let d of dArray) + g(__type="u8" __count="4") #{d[0]} #{d[1]} #{d[2]} #{d[3]} + ex + - for (let e of eArray) + e(__type="u32" __count="5") #{e[0]} #{e[1]} #{e[2]} #{e[3]} #{e[4]} + skin(__type="u16" __count="12") #{custom.frame} #{custom.turntable} #{custom.note_burst} #{custom.menu_music} #{appendsettings} #{custom.lane_cover} 0 #{custom.category_vox} 0 0 0 + rlist + - for (let rd of rArray) + rival(spdp=rd.play_style id=rd.profile[2] id_str=rd.profile[3] djname=rd.profile[0] pid=rd.profile[1] sg=rd.pcdata[0] dg=rd.pcdata[1] sa=rd.pcdata[2] da=rd.pcdata[3]) + visitor(anum="10" snum="10" pnum="10" vs_flg="1") + fcombo(__type="s16" __count="2") #{pcdata.fcombo[0]} #{pcdata.fcombo[1]} + jewel(rate="1") + jnum(__type="s64") #{pcdata.jewel_num} + bjnum(__type="s32" __count="18") #{pcdata.jewel_bnum[0]} #{pcdata.jewel_bnum[1]} #{pcdata.jewel_bnum[2]} #{pcdata.jewel_bnum[3]} #{pcdata.jewel_bnum[4]} #{pcdata.jewel_bnum[5]} #{pcdata.jewel_bnum[6]} #{pcdata.jewel_bnum[7]} #{pcdata.jewel_bnum[8]} #{pcdata.jewel_bnum[9]} #{pcdata.jewel_bnum[10]} #{pcdata.jewel_bnum[11]} #{pcdata.jewel_bnum[12]} #{pcdata.jewel_bnum[13]} #{pcdata.jewel_bnum[14]} #{pcdata.jewel_bnum[15]} #{pcdata.jewel_bnum[16]} #{pcdata.jewel_bnum[17]} diff --git a/iidx@asphyxia/util.ts b/iidx@asphyxia/util.ts index 160ac11..1447863 100644 --- a/iidx@asphyxia/util.ts +++ b/iidx@asphyxia/util.ts @@ -117,6 +117,7 @@ export function GetVersion(info: EamuseInfo) { let version = -1; switch (info.model.substring(0, 3)) { case "HDD": return 15; + case "I00": return 16; case "JDJ": return 17; case "JDZ": return 18; case "KDZ": return 19;