From b9bedd6d1f70311f382fff4fa2b799c92ffd764c Mon Sep 17 00:00:00 2001 From: duel0213 Date: Mon, 22 Jan 2024 16:49:57 +0900 Subject: [PATCH] IIDX: Initial support added for Resort Anthem --- iidx@asphyxia/README.md | 8 +- iidx@asphyxia/handlers/music.ts | 11 ++- iidx@asphyxia/handlers/pc.ts | 125 +++++++++++++++++++++++++++++--- iidx@asphyxia/handlers/shop.ts | 2 +- iidx@asphyxia/index.ts | 1 + iidx@asphyxia/models/pcdata.ts | 44 +++++++++-- iidx@asphyxia/pug/JDZ/pcget.pug | 18 +++++ iidx@asphyxia/util.ts | 1 + 8 files changed, 185 insertions(+), 25 deletions(-) create mode 100644 iidx@asphyxia/pug/JDZ/pcget.pug diff --git a/iidx@asphyxia/README.md b/iidx@asphyxia/README.md index f924e4e..637d943 100644 --- a/iidx@asphyxia/README.md +++ b/iidx@asphyxia/README.md @@ -1,11 +1,12 @@ # beatmaniaIIDX -Plugin Version: **v0.1.4** +Plugin Version: **v0.1.5** --- Supported Versions + - beatmaniaIIDX 18 Resort Anthem - beatmaniaIIDX 19 Lincle - beatmaniaIIDX 27 HEROIC VERSE - beatmaniaIIDX 28 BISTROVER @@ -46,3 +47,8 @@ Changelogs **v0.1.4** - Added Initial support for RESIDENT + +**v0.1.5** + - Added Initial support for Resort Anthem + - BEGINNER, LEAGUE, STORY does not work yet. + - Fixed s_hispeed/d_hispeed doesn't save correctly. diff --git a/iidx@asphyxia/handlers/music.ts b/iidx@asphyxia/handlers/music.ts index 173deea..401403c 100644 --- a/iidx@asphyxia/handlers/music.ts +++ b/iidx@asphyxia/handlers/music.ts @@ -23,7 +23,7 @@ export const musicgetrank: EPR = async (info, data, send) => { let m = [], top = []; let score_data: number[]; let indices, temp_mid = 0; - if (version == 19) { + if (version == 18 || version == 19) { indices = cltype === 0 ? [1, 2, 3] : [6, 7, 8]; music_data.forEach((res: score) => { temp_mid = NewMidToOldMid(res.mid); @@ -131,7 +131,7 @@ export const musicappoint: EPR = async (info, data, send) => { let clid = parseInt($(data).attr().clid); const mapping = [1, 2, 3, 6, 7, 8]; - if (version == 19) { + if (version == 18 || version == 19) { mid = OldMidToNewMid(mid); clid = mapping[clid]; } @@ -187,7 +187,7 @@ export const musicreg: EPR = async (info, data, send) => { const mapping = [1, 2, 3, 6, 7, 8]; if (version == -1) return send.deny(); - else if (version == 19) { + else if (version == 18 || version == 19) { mid = OldMidToNewMid(mid); if (mid == -1) return send.deny(); @@ -213,7 +213,7 @@ export const musicreg: EPR = async (info, data, send) => { let optArray = Array(10).fill(0); // USED OPTION (CastHour) // let opt2Array = Array(10).fill(0); // USED OPTION (CastHour) // - if (version >= 19) ghost = $(data).buffer("ghost").toString("base64"); + if (version >= 18) ghost = $(data).buffer("ghost").toString("base64"); if (version >= 27) { ghost_gauge = $(data).buffer("ghost_gauge").toString("base64"); @@ -260,7 +260,7 @@ export const musicreg: EPR = async (info, data, send) => { cArray[clid] = Math.max(cArray[clid], cflg); } - if (version >= 27) { + if (version >= 27) { // TODO:: support old version // const score_top: score_top | null = await DB.FindOne(null, { collection: "score_top", play_style: style, @@ -310,7 +310,6 @@ export const musicreg: EPR = async (info, data, send) => { } ); } - await DB.Upsert( refid, diff --git a/iidx@asphyxia/handlers/pc.ts b/iidx@asphyxia/handlers/pc.ts index 674b19d..2f16089 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 } from "../models/pcdata"; +import { pcdata, KDZ_pcdata, IIDX27_pcdata, IIDX28_pcdata, IIDX29_pcdata, IIDX30_pcdata, JDZ_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 } from "../util"; @@ -10,7 +10,37 @@ import { world_tourism } from "../models/worldtourism"; export const pccommon: EPR = async (info, data, send) => { const version = GetVersion(info); - if (version == 19) { + if (version == 18) { + return send.object({ + "@attr": { + expire: 600, + }, + ir: K.ATTR({ + beat: String(U.GetConfig("BeatPhase")), + }), + cmd: K.ATTR({ + gmbl: "1", + gmbla: "1", + regl: "1", + rndp: "1", + hrnd: "1", + alls: "1", + }), + lg: K.ATTR({ + lea: "0", + }), + lf: K.ATTR({ + life: "0", + }), + ev: K.ATTR({ + pha: "3", + }), + lincle: K.ATTR({ + phase: "1", + }) + }); + } + else if (version == 19) { return send.object({ "@attr": { expire: 600, @@ -31,11 +61,13 @@ export const pccommon: EPR = async (info, data, send) => { flg: String(-1), }), }); - } else if (version >= 27) { + } + else if (version >= 27) { return send.pugFile(`pug/LDJ/${version}pccommon.pug`, { beat: U.GetConfig("BeatPhase"), }); - } else { + } + else { return send.deny(); } }; @@ -50,6 +82,9 @@ export const pcreg: EPR = async (info, data, send) => { let lightning_settings: object; let lightning_playdata: object; switch (version) { + case 18: + pcdata = JDZ_pcdata; + break; case 19: pcdata = KDZ_pcdata; break; @@ -237,7 +272,26 @@ export const pcget: EPR = async (info, data, send) => { } let event, event_1, event_1s, evtArray = [], evtArray2 = []; - if (version == 19) { + if (version == 18) { + event = await DB.FindOne(refid, { collection: "event_1", version: version }); + + if (!_.isNil(event)) { + event.cf = Base64toBuffer(event.cf); + event.pf = Base64toBuffer(event.pf); + event.mf = Base64toBuffer(event.mf); + } + + return send.pugFile("pug/JDZ/pcget.pug", { + profile, + pcdata, + dArray, + appendsettings, + custom, + rArray, + event, + }); + } + else if (version == 19) { event = await DB.FindOne(refid, { collection: "event_1", version: version }); if (!_.isNil(event)) { @@ -413,6 +467,9 @@ export const pctakeover: EPR = async (info, data, send) => { let lightning_settings: object; let lightning_playdata: object; switch (version) { + case 18: + pcdata = JDZ_pcdata; + break; case 19: pcdata = KDZ_pcdata; break; @@ -553,7 +610,56 @@ export const pcsave: EPR = async (info, data, send) => { pcdata.mode = parseInt($(data).attr().mode); pcdata.pmode = parseInt($(data).attr().pmode); - if (version == 19) { + if (version == 18) { + 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.timing = parseInt($(data).attr().timing); + pcdata.sflg0 = parseInt($(data).attr().sflg0); + pcdata.sflg1 = parseInt($(data).attr().sflg1); + pcdata.sdhd = parseInt($(data).attr().sdhd); + pcdata.ncomb = parseInt($(data).attr().ncomb); + pcdata.mcomb = parseInt($(data).attr().mcomb); + pcdata.liflen = parseInt($(data).attr().lift); + + // TODO:: STORY/LEAGUE // + + if (!_.isNil($(data).element("tour"))) { + let event_data = { + cf: $(data).element("tour").buffer("cf").toString("base64"), + pf: $(data).element("tour").buffer("pf").toString("base64"), + mf: $(data).element("tour").buffer("mf").toString("base64"), + pt: parseInt($(data).attr("tour").pt), + rsv: parseInt($(data).attr("tour").rsv), + r0: parseInt($(data).attr("tour").r0), + r1: parseInt($(data).attr("tour").r1), + r2: parseInt($(data).attr("tour").r2), + r3: parseInt($(data).attr("tour").r3), + r4: parseInt($(data).attr("tour").r4), + r5: parseInt($(data).attr("tour").r5), + r6: parseInt($(data).attr("tour").r6), + r7: parseInt($(data).attr("tour").r7), + } + + DB.Upsert(refid, + { + collection: "event_1", + version: version, + }, + { + $set: event_data, + } + ); + } + } + else if (version == 19) { if (cltype == 0) { pcdata.sach = parseInt($(data).attr().achi); pcdata.sp_opt = parseInt($(data).attr().opt); @@ -628,7 +734,8 @@ export const pcsave: EPR = async (info, data, send) => { pcdata.p3 = $(data).element("history").numbers("p3"); pcdata.p4 = $(data).element("history").numbers("p4"); } - } else if (version >= 27) { + } + else if (version >= 27) { // lid bookkeep cid ctype ccode pcdata.rtype = parseInt($(data).attr().d_sdtype); pcdata.sach = parseInt($(data).attr().s_achi); @@ -659,8 +766,8 @@ export const pcsave: EPR = async (info, data, send) => { pcdata.d_judge = parseInt($(data).attr().d_judge); pcdata.s_judgeAdj = parseInt($(data).attr().s_judgeAdj); pcdata.d_judgeAdj = parseInt($(data).attr().d_judgeAdj); - pcdata.s_hispeed = parseInt($(data).attr().s_hispeed); - pcdata.d_hispeed = parseInt($(data).attr().d_hispeed); + pcdata.s_hispeed = parseFloat($(data).attr().s_hispeed); + pcdata.d_hispeed = parseFloat($(data).attr().d_hispeed); pcdata.s_opstyle = parseInt($(data).attr().s_opstyle); pcdata.d_opstyle = parseInt($(data).attr().d_opstyle); pcdata.s_graph_score = parseInt($(data).attr().s_graph_score); diff --git a/iidx@asphyxia/handlers/shop.ts b/iidx@asphyxia/handlers/shop.ts index b944dc2..7928a78 100644 --- a/iidx@asphyxia/handlers/shop.ts +++ b/iidx@asphyxia/handlers/shop.ts @@ -2,7 +2,7 @@ return send.object( K.ATTR({ status: "0", - opname: "CORE", + opname: "CORE", pid: "57", cls_opt: "0", hr: "0", diff --git a/iidx@asphyxia/index.ts b/iidx@asphyxia/index.ts index 807fc3f..07e8ff1 100644 --- a/iidx@asphyxia/index.ts +++ b/iidx@asphyxia/index.ts @@ -13,6 +13,7 @@ export function register() { R.Contributor("duel0213"); + R.GameCode("JDZ"); R.GameCode("KDZ"); R.GameCode("LDJ"); diff --git a/iidx@asphyxia/models/pcdata.ts b/iidx@asphyxia/models/pcdata.ts index 7138861..17de194 100644 --- a/iidx@asphyxia/models/pcdata.ts +++ b/iidx@asphyxia/models/pcdata.ts @@ -3,30 +3,33 @@ export interface pcdata { version: number; - spnum: number; // attributes (Lincle) // + spnum: number; dpnum: number; sach: number; dach: number; sflg0: number; sflg1: number; - help: number; gno: number; timing: number; sdhd: number; - sdtype: number; - notes: number; - pase: number; sp_opt: number; dp_opt: number; dp_opt2: number; + mcomb: number; + ncomb: number; mode: number; pmode: number; - ngrade: number; // <- attribute (BISTROVER) // - fcombo: number[]; liflen: number; - rtype: number; // attributes (Heroic Verse) // + notes: number; // attribute (Lincle) // + pase: number; + sdtype: number; + help: number; + fcombo: number[]; + ngrade: number; // attribute (BISTROVER) // + rtype: number; // attribute (Heroic Verse) // gpos: number; + s_sorttype: number; d_sorttype: number; s_pace: number; @@ -167,6 +170,31 @@ export interface pcdata { tourism_secret_flg2: string[]; } +export const JDZ_pcdata = { + version: 18, + + spnum: 0, + dpnum: 0, + sach: 0, + dach: 0, + sflg0: 0, + sflg1: 0, + gno: 0, + timing: 0, + sdhd: 0, + sp_opt: 0, + dp_opt: 0, + dp_opt2: 0, + mcomb: 0, + ncomb: 0, + mode: 0, + pmode: 0, + liflen: 0, + + sgid: -1, + dgid: -1, +} + export const KDZ_pcdata = { version: 19, diff --git a/iidx@asphyxia/pug/JDZ/pcget.pug b/iidx@asphyxia/pug/JDZ/pcget.pug new file mode 100644 index 0000000..5b3889a --- /dev/null +++ b/iidx@asphyxia/pug/JDZ/pcget.pug @@ -0,0 +1,18 @@ +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 gno=pcdata.gno timing=pcdata.timing 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 liflen=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 + 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]) + lincle(comflg="1" flg1="-1" flg2="-1" flg3="-1" flg4="-1" flg5="-1" flg6="-1" flg7="-1" refcomp="1") + reflec(tf="1" br="1" ssc="1" sr="1" wu="1" sg="1" tb="1") + jubeat(jflg_0="-1" jflg_1="-1" jflg_2="-1" jflg_3="-1") + if event != null + tour(pt=event.pt rsv=event.rsv r0=event.r0 r1=event.r1 r2=event.r2 r3=event.r3 r4=event.r4 r5=event.r5 r6=event.r6 r7=event.r7) + cf(__type="bin") #{event.cf} + pf(__type="bin") #{event.pf} + mf(__type="bin") #{event.mf} diff --git a/iidx@asphyxia/util.ts b/iidx@asphyxia/util.ts index a7c92f1..295db4d 100644 --- a/iidx@asphyxia/util.ts +++ b/iidx@asphyxia/util.ts @@ -59,6 +59,7 @@ export function Base64toBuffer(s: string) { export function GetVersion(info: EamuseInfo) { let version = -1; switch (info.model.substring(0, 3)) { + case "JDZ": return 18; case "KDZ": return 19; case "LDJ": return parseInt(info.module.substring(4, 6)); }