Merge pull request #10 from COLV9/webui-score-setting-fix1026

iidx webui score&settings fix
This commit is contained in:
duel0213
2026-10-27 20:55:40 +09:00
25 changed files with 1280 additions and 164 deletions

View File

@@ -66,6 +66,33 @@ const EVENT_DIFFICULTY_FIELD = 27;
const EVENT_DIFFICULTY_SONG_COUNT = 47; // Song IDs 79 through 125.
const ALL_SONGS_OPEN_MASK = '7fffffffffffffff'; // KDM uses 63 bits per bank.
const CHALLENGE_SONGS: number[] = [79, 81, 83, 84, 85, 86, 87, 92, 93, 94, 95, 96, 97, 98, 99];
// Internal 4-character song codes, used by the EVTMSG3 unlock records.
const EVENT_OPEN_CODES = [
'watc', // 79 Watch Out Pt.2
'todo', // 81 轟け!恋のビーンボール!!
'todm', // 82 轟け!(9回裏振付ver)
'sasu', // 83 Sakura Sunrise
'lits', // 84 Little Star
'tsum', // 85 罪と罰
'rfts', // 86 Reaching for the Stars
'luvc', // 87 LUV CAN SAVE U
'tada', // 89 TA・DA ☆ YO・SHI
'alst', // 91 アルストロメリア (walk with you remix)
'gimm', // 93 Gimme a Big Beat
'dind', // 94 Din Don Dan
'imso', // 95 I'm so Happy
'msou', // 96 無双
'sett', // 97 Settin' the Scene
'akat', // 98 朱と碧のランページ
'spec', // 99 Special One
];
function buildEventRecords(): string {
return `u:${EVENT_OPEN_CODES.join(':')}`;
}
// Extracted from this build's data/arc/resource_lists.arc. Array index = song ID.
const SONG_TITLES = [
"INTO YOUR HEART (Ruffage remix)", "A Geisha's Dream", 'La receta',
@@ -101,7 +128,8 @@ const SONG_TITLES = [
'Little Star', '罪と罰', 'Reaching for the Stars', 'LUV CAN SAVE U',
'チョコレートスマイル', 'TA・DA ☆ YO・SHI', 'ハッピーシンセサイザ',
'アルストロメリア (walk with you remix)', 'Kind Lady', 'Gimme a Big Beat',
'YESTERDAY', 'Din Don Dan', "I'm so Happy", '無双',
'Din Don Dan', "I'm so Happy", '無双', "Settin' the Scene",
'朱と碧のランページ', 'Special One',
];
function getRefId(data: any): string {
@@ -164,11 +192,16 @@ function unlockStoredRecord(record: StoredRecord, type: string): StoredRecord {
if (type === 'DATA12') {
// IDA: sub_100BE7D0 indexes this string by songId - 79. A character
// from '0' through '4' is the highest selectable difficulty.
// from '0' through '4' is the highest selectable difficulty
// challenge songs are the exception and get '3' (EXTREME).
const oldLevels = fields[EVENT_DIFFICULTY_FIELD] || Buffer.alloc(0);
const levels = Buffer.alloc(Math.max(oldLevels.length, EVENT_DIFFICULTY_SONG_COUNT));
oldLevels.copy(levels);
levels.fill(0x34, 0, EVENT_DIFFICULTY_SONG_COUNT); // ASCII '4'
for (const songId of CHALLENGE_SONGS) {
const idx = songId - 79;
if (idx >= 0 && idx < EVENT_DIFFICULTY_SONG_COUNT) levels[idx] = 0x33; // '3'
}
fields[EVENT_DIFFICULTY_FIELD] = levels;
}
@@ -779,21 +812,29 @@ export function register() {
R.Route('system.getmaster', async (info, data, send) => {
const information = String(U.GetConfig('information_text') || '');
const unlockAll = configBoolean('unlock_all_songs', true);
const masterData = unlockAll ? MASTER_DATA_UNLOCKED : MASTER_DATA_LOCKED;
// KDM stores strdata2 in the second half of its EVENTMSG record. The title
// parser reads the visible message after the second comma, so two header
// fields are required before the configured text.
const datakey = $(data).str('data.datakey', '');
// KDM queries one keyed master record per request:
// INFO, ARK_ARR0, ARK_HAS0, SONGOPEN, IRDATA, EVTMSG3, WEEKLYSO.
// strdata1/strdata2 are base64 text; updatedate must be non-zero
// and in the past for the game to use the record.
let strdata1 = '0';
if (datakey === 'EVTMSG3') {
// Opens the event songs in the wheel; only comma field 0 is parsed,
// so the legacy flags string rides along as a trailing field.
const flags = unlockAll ? MASTER_DATA_UNLOCKED : MASTER_DATA_LOCKED;
strdata1 = unlockAll ? `${buildEventRecords()},${flags}` : `0,${flags}`;
}
// KDM stores strdata2 in the second half of the record.
// The title parser reads the visible message after the second comma,
// so two header fields are required before the configured text.
const eventMessage = `0,0,${information}`;
return send.object({
result: K.ITEM('s32', 1),
strdata1: K.ITEM(
'str',
Buffer.from(masterData, 'utf-8').toString('base64')
),
strdata1: K.ITEM('str', Buffer.from(strdata1, 'utf-8').toString('base64')),
strdata2: K.ITEM('str', U.EncodeString(eventMessage, 'shift_jis').toString('base64')),
// Use the request time so WebUI changes are not hidden by KDM's cached
// master revision until CORE itself is restarted.
updatedate: K.ITEM('u64', BigInt(String(Math.floor(Date.now() / 1000)))),
// Always non-zero and in the past so the game accepts the record.
updatedate: K.ITEM('u64', BigInt(1)),
});
});

View File

@@ -209,4 +209,10 @@ Changelogs
- Fixed where classic\_hispeed option doesn't get saved on WebUI
- Fixed where CLEAR RATE, FULL COMBO RATE only displays 0% or 100%
- Fixed where Note Size, Note Beam Size, First Note Preview may display wrong data on WebUI
- Fixed where Recently Played sorted by song rather than each difficulty (@COLV9)
- Added last played time saving for each difficulty
- Existing score data without play time will be treated as not recently played until the chart is played again
- Added pagination to the WebUI score viewer (@COLV9)
- Added options to display 10, 30, or 50 records per page
- Updated music title and customization lists (@COLV9)
- Random Lane Ticket now stores ticket on database rather than give 100 temporarily batches on login

View File

@@ -813,6 +813,7 @@ export const musicreg: EPR = async (info, data, send) => {
let esArray = Array<number>(10).fill(0); // EXSCORE //
let optArray = Array<number>(10).fill(0); // USED OPTION (CastHour) //
let opt2Array = Array<number>(10).fill(0); // USED OPTION (CastHour) //
let playTimeArray = Array<number>(10).fill(0); // LAST PLAYED TIME BY DIFFICULTY //
let update = 0;
if (version == 12 || version == 13) {
@@ -856,6 +857,10 @@ export const musicreg: EPR = async (info, data, send) => {
rArray = music_data.rArray;
}
if (!_.isNil(music_data.playTimeArray)) {
playTimeArray = music_data.playTimeArray;
}
// migration for invalid miss count //
// if EXSCORE/MISS COUNT is 0 and CLEAR FLAG is NO PLAY then set MISS COUNT to -1 //
for (let a = 0; a < mArray.length; a++) {
@@ -933,6 +938,8 @@ export const musicreg: EPR = async (info, data, send) => {
);
}
playTimeArray[clid] = Date.now();
await DB.Upsert<score>(
refid,
{
@@ -949,6 +956,7 @@ export const musicreg: EPR = async (info, data, send) => {
esArray,
optArray,
opt2Array,
playTimeArray,
[clid]: ghost,
[clid + 10]: ghost_gauge,
@@ -1236,6 +1244,7 @@ export const musicbreg: EPR = async (info, data, send) => {
let esArray = Array<number>(10).fill(0); // EXSCORE //
let optArray = Array<number>(10).fill(0); // USED OPTION (CastHour) //
let opt2Array = Array<number>(10).fill(0); // USED OPTION (CastHour) //
let playTimeArray = Array<number>(10).fill(0); // LAST PLAYED TIME BY DIFFICULTY //
if (_.isNil(music_data)) {
pgArray[clid] = pgnum;
@@ -1260,6 +1269,10 @@ export const musicbreg: EPR = async (info, data, send) => {
rArray = music_data.rArray;
}
if (!_.isNil(music_data.playTimeArray)) {
playTimeArray = music_data.playTimeArray;
}
const pExscore = esArray[clid];
if (exscore > pExscore) {
pgArray[clid] = Math.max(pgArray[clid], pgnum);
@@ -1270,6 +1283,8 @@ export const musicbreg: EPR = async (info, data, send) => {
cArray[clid] = Math.max(cArray[clid], cflg);
}
playTimeArray[clid] = Date.now();
await DB.Upsert<score>(
refid,
{
@@ -1286,6 +1301,7 @@ export const musicbreg: EPR = async (info, data, send) => {
esArray,
optArray,
opt2Array,
playTimeArray,
[clid]: null,
[clid + 10]: null,

View File

@@ -12,6 +12,7 @@ export interface score {
optArray: number[];
opt2Array: number[];
playTimeArray?: number[];
}
export interface score_top {

View File

@@ -1,127 +0,0 @@
IIDX34pc(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 mode=pcdata.mode category=pcdata.category pmode=pcdata.pmode ngrade=pcdata.ngrade mdetail=pcdata.mdetail rtype=pcdata.rtype naviflg=pcdata.naviflg bgnasst=pcdata.bgnasst player_kind=pcdata.player_kind sp_opt=pcdata.sp_opt dp_opt=pcdata.dp_opt dp_opt2=pcdata.dp_opt2 gpos=pcdata.gpos s_sorttype=pcdata.s_sorttype d_sorttype=pcdata.d_sorttype s_pace=pcdata.s_pace d_pace=pcdata.d_pace s_gno=pcdata.s_gno d_gno=pcdata.d_gno s_sub_gno=pcdata.s_sub_gno d_sub_gno=pcdata.d_sub_gno s_gtype=pcdata.s_gtype d_gtype=pcdata.d_gtype s_sdlen=pcdata.s_sdlen d_sdlen=pcdata.d_sdlen s_sdtype=pcdata.s_sdtype d_sdtype=pcdata.d_sdtype s_timing=pcdata.s_timing d_timing=pcdata.d_timing s_notes=pcdata.s_notes d_notes=pcdata.d_notes s_judge=pcdata.s_judge d_judge=pcdata.d_judge s_judgeAdj=pcdata.s_judgeAdj d_judgeAdj=pcdata.d_judgeAdj s_hispeed=pcdata.s_hispeed d_hispeed=pcdata.d_hispeed s_liflen=pcdata.s_liflen d_liflen=pcdata.d_liflen s_disp_judge=pcdata.s_disp_judge d_disp_judge=pcdata.d_disp_judge s_opstyle=pcdata.s_opstyle d_opstyle=pcdata.d_opstyle s_graph_score=pcdata.s_graph_score d_graph_score=pcdata.d_graph_score s_auto_scrach=pcdata.s_auto_scrach d_auto_scrach=pcdata.d_auto_scrach s_gauge_disp=pcdata.s_gauge_disp d_gauge_disp=pcdata.d_gauge_disp s_lane_brignt=pcdata.s_lane_brignt d_lane_brignt=pcdata.d_lane_brignt s_camera_layout=pcdata.s_camera_layout d_camera_layout=pcdata.d_camera_layout s_ghost_score=pcdata.s_ghost_score d_ghost_score=pcdata.d_ghost_score s_tsujigiri_disp=pcdata.s_tsujigiri_disp d_tsujigiri_disp=pcdata.d_tsujigiri_disp s_auto_adjust=pcdata.s_auto_adjust d_auto_adjust=pcdata.d_auto_adjust s_timing_split=pcdata.s_timing_split d_timing_split=pcdata.d_timing_split s_visualization=pcdata.s_visualization d_visualization=pcdata.d_visualization s_classic_hispeed=pcdata.s_classic_hispeed d_classic_hispeed=pcdata.d_classic_hispeed movie_thumbnail=pcdata.movie_thumbnail s_laneobj_brignt=pcdata.s_laneobj_brignt d_laneobj_brignt=pcdata.d_laneobj_brignt s_bpm_notice=pcdata.s_bpm_notice d_bpm_notice=pcdata.d_bpm_notice s_sd_adjust=pcdata.s_sd_adjust d_sd_adjust=pcdata.d_sd_adjust s_disp_area_fix=pcdata.s_disp_area_fix d_disp_area_fix=pcdata.d_disp_area_fix s_always_disp_num=pcdata.s_always_disp_num d_always_disp_num=pcdata.d_always_disp_num)
lightning_play_data(dpnum=lm_playdata.dp_num spnum=lm_playdata.sp_num)
lightning_setting(headphone_vol=lm_settings.headphone_vol resistance_dp_left=lm_settings.resistance_dp_left resistance_dp_right=lm_settings.resistance_dp_right resistance_sp_left=lm_settings.resistance_sp_left resistance_sp_right=lm_settings.resistance_sp_right keyboard_kind=lm_settings.keyboard_kind assistant_disp_type=lm_settings.assistant_disp_type assistant_last_tab=lm_settings.assistant_last_tab assistant_chara=lm_settings.assistant_chara)
slider(__type="s32" __count="7") #{lm_settings.slider[0]} #{lm_settings.slider[1]} #{lm_settings.slider[2]} #{lm_settings.slider[3]} #{lm_settings.slider[4]} #{lm_settings.slider[5]} #{lm_settings.slider[6]}
light(__type="bool" __count="10") #{lm_settings.light[0]} #{lm_settings.light[1]} #{lm_settings.light[2]} #{lm_settings.light[3]} #{lm_settings.light[4]} #{lm_settings.light[5]} #{lm_settings.light[6]} #{lm_settings.light[7]} #{lm_settings.light[8]} #{lm_settings.light[9]}
concentration(__type="bool") #{lm_settings.concentration}
spdp_rival(flg="-1")
bind_eaappli
ea_premium_course
dellar_bonus(rate="100")
secret
flg1(__type="s64" __count="3") -1 -1 -1
flg2(__type="s64" __count="3") -1 -1 -1
flg3(__type="s64" __count="3") -1 -1 -1
flg4(__type="s64" __count="3") -1 -1 -1
flg5(__type="s64" __count="3") -1 -1 -1
leggendaria
flg1(__type="s64" __count="3") -1 -1 -1
flg2(__type="s64" __count="3") -1 -1 -1
music_memo
- for (let m of mArray)
folder(play_style=m.play_style folder_id=m.folder_idx name=m.folder_name)
music_id(__type="s32" __count="10") #{m.music_ids[0]} #{m.music_ids[1]} #{m.music_ids[2]} #{m.music_ids[3]} #{m.music_ids[4]} #{m.music_ids[5]} #{m.music_ids[6]} #{m.music_ids[7]} #{m.music_ids[8]} #{m.music_ids[9]}
music_filter
- for (let f of fArray)
folder(play_style=f.play_style folder_id=f.folder_id filter_id=f.filter_id value0=f.value0 value1=f.value1)
is_valid(__type="bool") #{f.is_valid}
- for (let fs of fsArray)
sort(play_style=fs.play_style folder_id=fs.folder_id sort=fs.sort)
qpro_secret
head(__type="s64" __count="7") #{custom.qpro_secret_head[0]} #{custom.qpro_secret_head[1]} #{custom.qpro_secret_head[2]} #{custom.qpro_secret_head[3]} #{custom.qpro_secret_head[4]} #{custom.qpro_secret_head[5]} #{custom.qpro_secret_head[6]}
hair(__type="s64" __count="7") #{custom.qpro_secret_hair[0]} #{custom.qpro_secret_hair[1]} #{custom.qpro_secret_hair[2]} #{custom.qpro_secret_hair[3]} #{custom.qpro_secret_hair[4]} #{custom.qpro_secret_hair[5]} #{custom.qpro_secret_hair[6]}
face(__type="s64" __count="7") #{custom.qpro_secret_face[0]} #{custom.qpro_secret_face[1]} #{custom.qpro_secret_face[2]} #{custom.qpro_secret_face[3]} #{custom.qpro_secret_face[4]} #{custom.qpro_secret_face[5]} #{custom.qpro_secret_face[6]}
body(__type="s64" __count="7") #{custom.qpro_secret_body[0]} #{custom.qpro_secret_body[1]} #{custom.qpro_secret_body[2]} #{custom.qpro_secret_body[3]} #{custom.qpro_secret_body[4]} #{custom.qpro_secret_body[5]} #{custom.qpro_secret_body[6]}
hand(__type="s64" __count="7") #{custom.qpro_secret_hand[0]} #{custom.qpro_secret_hand[1]} #{custom.qpro_secret_hand[2]} #{custom.qpro_secret_hand[3]} #{custom.qpro_secret_hand[4]} #{custom.qpro_secret_hand[5]} #{custom.qpro_secret_hand[6]}
back(__type="s64" __count="7") #{custom.qpro_secret_back[0]} #{custom.qpro_secret_back[1]} #{custom.qpro_secret_back[2]} #{custom.qpro_secret_back[3]} #{custom.qpro_secret_back[4]} #{custom.qpro_secret_back[5]} #{custom.qpro_secret_back[6]}
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]}
pskin(__type="s32" __count="22") #{appendsettings} #{custom.note_burst} #{custom.bomb_size} #{custom.turntable} #{custom.judge_font} #{custom.note_skin} #{custom.note_size} #{Number(custom.disable_musicpreview)} #{Number(custom.vefx_lock)} #{custom.effect} #{custom.menu_music} #{Number(custom.disable_hcn_color)} #{custom.first_note_preview} #{custom.lane_cover} #{custom.pacemaker_cover} #{custom.lift_cover} #{custom.note_beam} #{custom.note_beam_size} #{custom.full_combo_splash} #{custom.frame} #{custom.cn_color} #{custom.cn_size}
vskin(__type="s32" __count="4") #{lm_custom.premium_skin} #{lm_custom.premium_bg} #{lm_custom.premium_bg_concent} #{lm_custom.entry_bg}
vskin_customize_setting(entrybg_brightness=lm_custom.entry_bg_brightness subbg_brightness=lm_settings.brightness concentration_brightness=lm_settings.brightness_concent)
qprodata(__type="u32" __count="6") #{custom.qpro_head} #{custom.qpro_hair} #{custom.qpro_face} #{custom.qpro_hand} #{custom.qpro_body} #{custom.qpro_back}
//-qproattendant0(__type="u32" __count"6") head hair face hand body back?
//-qproattendant1(__type="u32" __count"6") head hair face hand body back?
//-qproattendant2(__type="u32" __count"6") head hair face hand body back?
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])
is_robo(__type="bool") 0
qprodata(body=rd.qprodata[3] face=rd.qprodata[2] hair=rd.qprodata[0] hand=rd.qprodata[4] head=rd.qprodata[1] back=rd.qprodata[5])
shop(name=shop_data.opname)
rlist_sub
- for (let rsd of rsArray)
rival(spdp=rsd.play_style id=rsd.profile[2] id_str=rsd.profile[3] djname=rsd.profile[0] pid=rsd.profile[1] sg=rsd.pcdata[0] dg=rsd.pcdata[1] sa=rsd.pcdata[2] da=rsd.pcdata[3])
is_robo(__type="bool") 0
qprodata(body=rsd.qprodata[3] face=rsd.qprodata[2] hair=rsd.qprodata[0] hand=rsd.qprodata[4] head=rsd.qprodata[1] back=rsd.qprodata[5])
shop(name=shop_data.opname)
notes_radar(style="0")
radar_score(__type="s32" __count="6") #{pcdata.nr_spradar[0]} #{pcdata.nr_spradar[1]} #{pcdata.nr_spradar[2]} #{pcdata.nr_spradar[3]} #{pcdata.nr_spradar[4]} #{pcdata.nr_spradar[5]}
notes_radar(style="1")
radar_score(__type="s32" __count="6") #{pcdata.nr_dpradar[0]} #{pcdata.nr_dpradar[1]} #{pcdata.nr_dpradar[2]} #{pcdata.nr_dpradar[3]} #{pcdata.nr_dpradar[4]} #{pcdata.nr_dpradar[5]}
visitor(anum="10" snum="10" pnum="10" vs_flg="1")
step(enemy_damage=pcdata.st_enemy_damage progress=pcdata.st_progress total_point=pcdata.st_total_point enemy_defeat_flg=pcdata.st_enemy_defeat_flg sp_level=pcdata.st_sp_level dp_level=pcdata.st_dp_level sp_level_h=pcdata.st_sp_level_h dp_level_h=pcdata.st_dp_level_h sp_level_exh=pcdata.st_sp_level_exh dp_level_exh=pcdata.st_dp_level_exh sp_fluctuation=pcdata.st_sp_fluctuation dp_fluctuation=pcdata.st_dp_fluctuation sp_mplay=pcdata.st_sp_mplay dp_mplay=pcdata.st_dp_mplay tips_read_list=pcdata.st_tips_read_list)
is_track_ticket(__type="bool") #{Number(pcdata.st_is_track_ticket)}
packinfo(music_0="-1" music_1="-1" music_2="-1" pack_id="1")
achievements(pack=pcdata.achi_pack pack_comp=pcdata.achi_packcomp last_weekly=pcdata.achi_lastweekly weekly_num=pcdata.achi_weeklynum visit_flg=pcdata.achi_visitflg rival_crush=pcdata.achi_rivalcrush)
deller(deller=pcdata.deller)
orb_data(rest_orb=pcdata.orb present_orb=pcdata.present_orb)
old_linkage_secret_flg(triple_tribe_3="65535" triple_tribe_4="65535" triple_tribe_5="65535" triple_tribe_6="65535" popn_cheers="65535" bemani_summer="65535")
battle_setting
default_chat
other
hide_shopname(__type="bool") 0
pskin_customize_flg(skin_frame_flg="-1" skin_turntable_flg="-1" skin_bomb_flg="-1" skin_bgm_flg="-1" skin_lane_flg0="-1" skin_lane_flg1="-1" skin_lane_flg2="-1" skin_lane_flg3="-1" skin_lane_flg4="-1" skin_lane_flg5="-1" skin_lane_flg6="-1" skin_lane_flg7="-1" skin_notes_flg="-1" skin_fullcombo_flg="-1" skin_keybeam_flg="-1" skin_judgestring_flg="-1")
vskin_customize_flg(skin_subicon_flg="-1" skin_subbg_flg0="-1" skin_subbg_flg1="-1" skin_subbg_flg2="-1" skin_entry_flg0="-1" skin_entry_flg1="-1")
ultimate_mobile_link(music_list="-1")
link_flag
language_setting(language=profile.language)
movie_agreement(agreement_version="1")
movie_setting
hide_name(__type="bool") 0
world_tourism_secret_flg
flg1(__type="s64" __count="3") -1 -1 -1
flg2(__type="s64" __count="3") -1 -1 -1
badge
- for (let b of bArray)
badge_data(category_id=b.id badge_flg_id=b.flg_id badge_flg=b.flg)
activity
today(day_id=activityDayId date=activityTimestamp)
if activityTodaySP != null
today_data(play_style=activityTodaySP.play_style music_num=activityTodaySP.music_num play_time=activityTodaySP.play_time keyboard_num=activityTodaySP.keyboard_num scratch_num=activityTodaySP.scratch_num)
clear_update_num(__type="s32" __count="13") #{activityTodaySP.clear_update_num[0]} #{activityTodaySP.clear_update_num[1]} #{activityTodaySP.clear_update_num[2]} #{activityTodaySP.clear_update_num[3]} #{activityTodaySP.clear_update_num[4]} #{activityTodaySP.clear_update_num[5]} #{activityTodaySP.clear_update_num[6]} #{activityTodaySP.clear_update_num[7]} #{activityTodaySP.clear_update_num[8]} #{activityTodaySP.clear_update_num[9]} #{activityTodaySP.clear_update_num[10]} #{activityTodaySP.clear_update_num[11]} #{activityTodaySP.clear_update_num[12]}
score_update_num(__type="s32" __count="13") #{activityTodaySP.score_update_num[0]} #{activityTodaySP.score_update_num[1]} #{activityTodaySP.score_update_num[2]} #{activityTodaySP.score_update_num[3]} #{activityTodaySP.score_update_num[4]} #{activityTodaySP.score_update_num[5]} #{activityTodaySP.score_update_num[6]} #{activityTodaySP.score_update_num[7]} #{activityTodaySP.score_update_num[8]} #{activityTodaySP.score_update_num[9]} #{activityTodaySP.score_update_num[10]} #{activityTodaySP.score_update_num[11]} #{activityTodaySP.score_update_num[12]}
if activityTodayDP != null
today_data(play_style=activityTodayDP.play_style music_num=activityTodayDP.music_num play_time=activityTodayDP.play_time keyboard_num=activityTodayDP.keyboard_num scratch_num=activityTodayDP.scratch_num)
clear_update_num(__type="s32" __count="13") #{activityTodayDP.clear_update_num[0]} #{activityTodayDP.clear_update_num[1]} #{activityTodayDP.clear_update_num[2]} #{activityTodayDP.clear_update_num[3]} #{activityTodayDP.clear_update_num[4]} #{activityTodayDP.clear_update_num[5]} #{activityTodayDP.clear_update_num[6]} #{activityTodayDP.clear_update_num[7]} #{activityTodayDP.clear_update_num[8]} #{activityTodayDP.clear_update_num[9]} #{activityTodayDP.clear_update_num[10]} #{activityTodayDP.clear_update_num[11]} #{activityTodayDP.clear_update_num[12]}
score_update_num(__type="s32" __count="13") #{activityTodayDP.score_update_num[0]} #{activityTodayDP.score_update_num[1]} #{activityTodayDP.score_update_num[2]} #{activityTodayDP.score_update_num[3]} #{activityTodayDP.score_update_num[4]} #{activityTodayDP.score_update_num[5]} #{activityTodayDP.score_update_num[6]} #{activityTodayDP.score_update_num[7]} #{activityTodayDP.score_update_num[8]} #{activityTodayDP.score_update_num[9]} #{activityTodayDP.score_update_num[10]} #{activityTodayDP.score_update_num[11]} #{activityTodayDP.score_update_num[12]}
weekly
week_data(play_style="0")
- for (let a of activityWeekSP)
week(week_index=a.week_index week_id=a.week_id date=a.date music_num=a.music_num play_time=a.play_time keyboard_num=a.keyboard_num scratch_num=a.scratch_num)
clear_update_num(__type="s32" __count="13") #{a.clear_update_num[0]} #{a.clear_update_num[1]} #{a.clear_update_num[2]} #{a.clear_update_num[3]} #{a.clear_update_num[4]} #{a.clear_update_num[5]} #{a.clear_update_num[6]} #{a.clear_update_num[7]} #{a.clear_update_num[8]} #{a.clear_update_num[9]} #{a.clear_update_num[10]} #{a.clear_update_num[11]} #{a.clear_update_num[12]}
score_update_num(__type="s32" __count="13") #{a.score_update_num[0]} #{a.score_update_num[1]} #{a.score_update_num[2]} #{a.score_update_num[3]} #{a.score_update_num[4]} #{a.score_update_num[5]} #{a.score_update_num[6]} #{a.score_update_num[7]} #{a.score_update_num[8]} #{a.score_update_num[9]} #{a.score_update_num[10]} #{a.score_update_num[11]} #{a.score_update_num[12]}
week_data(play_style="1")
- for (let b of activityWeekDP)
week(week_index=b.week_index week_id=b.week_id date=b.date music_num=b.music_num play_time=b.play_time keyboard_num=b.keyboard_num scratch_num=b.scratch_num)
clear_update_num(__type="s32" __count="13") #{b.clear_update_num[0]} #{b.clear_update_num[1]} #{b.clear_update_num[2]} #{b.clear_update_num[3]} #{b.clear_update_num[4]} #{b.clear_update_num[5]} #{b.clear_update_num[6]} #{b.clear_update_num[7]} #{b.clear_update_num[8]} #{b.clear_update_num[9]} #{b.clear_update_num[10]} #{b.clear_update_num[11]} #{b.clear_update_num[12]}
score_update_num(__type="s32" __count="13") #{b.score_update_num[0]} #{b.score_update_num[1]} #{b.score_update_num[2]} #{b.score_update_num[3]} #{b.score_update_num[4]} #{b.score_update_num[5]} #{b.score_update_num[6]} #{b.score_update_num[7]} #{b.score_update_num[8]} #{b.score_update_num[9]} #{b.score_update_num[10]} #{b.score_update_num[11]} #{b.score_update_num[12]}
mynews
- for (let a of activityMynews)
detail(play_style=a.play_style kind=a.kind news_no=a.news_no index=a.index day_id=a.day_id music_id=a.music_id note_id=a.note_id best_score=a.best_score now_score=a.now_score now_clear=a.now_clear news_time=a.news_time)
best_result
- for (let a of activityMybest)
best_data(play_style=a.play_style kind=a.kind play_side=a.play_side music_id=a.music_id note_id=a.note_id target_graph=a.target_graph target_score=a.target_score pacemaker=a.pacemaker best_clear=a.best_clear best_score=a.best_score best_misscount=a.best_misscount now_clear=a.now_clear now_score=a.now_score now_misscount=a.now_misscount now_pgreat=a.now_pgreat now_great=a.now_great now_good=a.now_good now_bad=a.now_bad now_poor=a.now_poor now_combo=a.now_combo now_fast=a.now_fast now_slow=a.now_slow option=a.option option2=a.option_2 gauge_type=a.gauge_type result_type=a.result_type update_date=a.update_date)
ghost_gauge_data(__type="bin") #{a.ghost_gauge_data}
is_special_result(__type="bool") #{a.is_special_result}
djl_v(view_type=(custom.djl_v ? "0" : "2"))
//-voice
fvoice(id="" prev="") [loop]
music_retry_sp
- for (let a of retry_ticket_sp)
ticket(ticket_id=a.ticket_id music_id=a.music_id class_id=a.class_id arrange_id=a.arrange_id arrange_id2=a.arrange_id2 option=a.option option2=a.option2 expire_date=a.expire_date)
music_retry_dp
- for (let b of retry_ticket_dp)
ticket(ticket_id=b.ticket_id music_id=b.music_id class_id=b.class_id arrange_id=b.arrange_id arrange_id2=b.arrange_id2 option=b.option option2=b.option2 expire_date=a.expire_date)

View File

@@ -101,11 +101,30 @@ div
{val: 19, name: 'キャノンボーラーズ (CB)'},
{val: 20, name: 'Rootage'},
{val: 21, name: 'HEROIC VERSE'},
{val: 22, name: 'CastHour'},
{val: 23, name: 'RESIDENT'},
{val: 24, name: 'いちご (strawberry)'},
{val: 25, name: 'EPOLIS'},
{val: 26, name: 'Pinky Crush'}
{val: 22, name: 'Turntable 22'},
{val: 23, name: 'Turntable 23'},
{val: 24, name: 'Turntable 24'},
{val: 25, name: 'Turntable 25'},
{val: 26, name: 'Turntable 26'},
{val: 27, name: 'Turntable 27'},
{val: 28, name: 'Turntable 28'},
{val: 29, name: 'いちご (strawberry)'},
{val: 30, name: 'CastHour'},
{val: 31, name: 'Turntable 31'},
{val: 32, name: 'Turntable 32'},
{val: 33, name: 'Turntable 33'},
{val: 34, name: 'Turntable 34'},
{val: 35, name: 'Turntable 35'},
{val: 36, name: 'Turntable 36'},
{val: 37, name: 'Turntable 37'},
{val: 38, name: 'Turntable 38'},
{val: 39, name: 'Turntable 39'},
{val: 40, name: 'Turntable 40'},
{val: 41, name: 'RESIDENT'},
{val: 42, name: 'Turntable 42'},
{val: 43, name: 'EPOLIS'},
{val: 44, name: 'Pinky Crush'},
{val: 45, name: 'Sparkle Shower'}
]
each item in turntable_types
option(value=item.val, selected=(custom.turntable == item.val)) #{item.name}
@@ -141,7 +160,8 @@ div
{val: 22, name: 'いいねフラッシュ (Like👍 flash)'},
{val: 23, name: 'RESIDENT'},
{val: 24, name: 'EPOLIS'},
{val: 25, name: 'Pinky Crush'}
{val: 25, name: 'Pinky Crush'},
{val: 26, name: 'Sparkle Shower'}
]
each item in note_burst_types
option(value=item.val, selected=(custom.note_burst == item.val)) #{item.name}
@@ -178,7 +198,8 @@ div
{val: 6, name: 'Simple'},
{val: 7, name: 'Light'},
{val: 8, name: 'Tricoro'},
{val: 9, name: 'Bubble'}
{val: 9, name: 'Bubble'},
{val: 10, name: 'Fruity'}
]
each ns in note_skin_types
option(value=ns.val, selected=(custom.note_skin == ns.val)) #{ns.name}
@@ -216,7 +237,8 @@ div
{val: 10, name: 'フレネルビーム (Fresnel beam)'},
{val: 11, name: 'RESIDENT'},
{val: 12, name: 'EPOLIS'},
{val: 13, name: 'Pinky Crush'}
{val: 13, name: 'Pinky Crush'},
{val: 14, name: 'Sparkle Shower'}
]
each item in note_beam_types
option(value=item.val, selected=(custom.note_beam == item.val)) #{item.name}
@@ -573,7 +595,40 @@ div
{val: 329, name: '灼熱 Lost Summer Dayz'},
{val: 330, name: 'get set mind'},
{val: 331, name: 'Raspberry Potion'},
{val: 332, name: 'Secret Rouge'}
{val: 332, name: 'Secret Rouge'},
{val: 333, name: 'u gotta beat'},
{val: 334, name: 'lane334'},
{val: 335, name: 'lane335'},
{val: 336, name: 'lane336'},
{val: 337, name: 'lane337'},
{val: 338, name: 'lane338'},
{val: 339, name: 'lane339'},
{val: 340, name: 'lane340'},
{val: 341, name: 'lane341'},
{val: 342, name: 'lane342'},
{val: 343, name: 'lane343'},
{val: 344, name: 'lane344'},
{val: 345, name: 'lane345'},
{val: 346, name: 'スキッテイエェエエェ!!!!'},
{val: 347, name: 'Galaxy Collapse'},
{val: 348, name: 'Bang-Boo Bumble'},
{val: 349, name: 'Aqvion'},
{val: 350, name: 'SμG@R RU$#'},
{val: 351, name: 'FlyAway'},
{val: 352, name: 'ドリムチウ'},
{val: 353, name: 'Skratch Education Lv-1'},
{val: 354, name: 'Uaigh Gealai'},
{val: 355, name: 'Without Heaven'},
{val: 356, name: 'Sparkle Shower'},
{val: 357, name: 'デラむぅのでらっくす☆どり~むぅ'},
{val: 358, name: 'Makin\' It'},
{val: 359, name: 'ベラ・ベ・カラベラ'},
{val: 360, name: 'Bang Bang Dance'},
{val: 361, name: 'Nyan Nyan University'},
{val: 362, name: '好吃来世deエレクトリック'},
{val: 363, name: 'Begin'},
{val: 364, name: 'BattleRoyal'},
{val: 365, name: 'Disco Killer Music Lover'}
]
each item in lane_cover_types
option(value=item.val, selected=(custom.lane_cover == item.val)) #{item.name}
@@ -916,7 +971,40 @@ div
{val: 329, name: '灼熱 Lost Summer Dayz'},
{val: 330, name: 'get set mind'},
{val: 331, name: 'Raspberry Potion'},
{val: 332, name: 'Secret Rouge'}
{val: 332, name: 'Secret Rouge'},
{val: 333, name: 'u gotta beat'},
{val: 334, name: 'lane334'},
{val: 335, name: 'lane335'},
{val: 336, name: 'lane336'},
{val: 337, name: 'lane337'},
{val: 338, name: 'lane338'},
{val: 339, name: 'lane339'},
{val: 340, name: 'lane340'},
{val: 341, name: 'lane341'},
{val: 342, name: 'lane342'},
{val: 343, name: 'lane343'},
{val: 344, name: 'lane344'},
{val: 345, name: 'lane345'},
{val: 346, name: 'スキッテイエェエエェ!!!!'},
{val: 347, name: 'Galaxy Collapse'},
{val: 348, name: 'Bang-Boo Bumble'},
{val: 349, name: 'Aqvion'},
{val: 350, name: 'SμG@R RU$#'},
{val: 351, name: 'FlyAway'},
{val: 352, name: 'ドリムチウ'},
{val: 353, name: 'Skratch Education Lv-1'},
{val: 354, name: 'Uaigh Gealai'},
{val: 355, name: 'Without Heaven'},
{val: 356, name: 'Sparkle Shower'},
{val: 357, name: 'デラむぅのでらっくす☆どり~むぅ'},
{val: 358, name: 'Makin\' It'},
{val: 359, name: 'ベラ・ベ・カラベラ'},
{val: 360, name: 'Bang Bang Dance'},
{val: 361, name: 'Nyan Nyan University'},
{val: 362, name: '好吃来世deエレクトリック'},
{val: 363, name: 'Begin'},
{val: 364, name: 'BattleRoyal'},
{val: 365, name: 'Disco Killer Music Lover'}
]
each item in lift_cover_types
option(value=item.val, selected=(custom.lift_cover == item.val)) #{item.name}
@@ -1259,7 +1347,40 @@ div
{val: 329, name: '灼熱 Lost Summer Dayz'},
{val: 330, name: 'get set mind'},
{val: 331, name: 'Raspberry Potion'},
{val: 332, name: 'Secret Rouge'}
{val: 332, name: 'Secret Rouge'},
{val: 333, name: 'u gotta beat'},
{val: 334, name: 'lane334'},
{val: 335, name: 'lane335'},
{val: 336, name: 'lane336'},
{val: 337, name: 'lane337'},
{val: 338, name: 'lane338'},
{val: 339, name: 'lane339'},
{val: 340, name: 'lane340'},
{val: 341, name: 'lane341'},
{val: 342, name: 'lane342'},
{val: 343, name: 'lane343'},
{val: 344, name: 'lane344'},
{val: 345, name: 'lane345'},
{val: 346, name: 'スキッテイエェエエェ!!!!'},
{val: 347, name: 'Galaxy Collapse'},
{val: 348, name: 'Bang-Boo Bumble'},
{val: 349, name: 'Aqvion'},
{val: 350, name: 'SμG@R RU$#'},
{val: 351, name: 'FlyAway'},
{val: 352, name: 'ドリムチウ'},
{val: 353, name: 'Skratch Education Lv-1'},
{val: 354, name: 'Uaigh Gealai'},
{val: 355, name: 'Without Heaven'},
{val: 356, name: 'Sparkle Shower'},
{val: 357, name: 'デラむぅのでらっくす☆どり~むぅ'},
{val: 358, name: 'Makin\' It'},
{val: 359, name: 'ベラ・ベ・カラベラ'},
{val: 360, name: 'Bang Bang Dance'},
{val: 361, name: 'Nyan Nyan University'},
{val: 362, name: '好吃来世deエレクトリック'},
{val: 363, name: 'Begin'},
{val: 364, name: 'BattleRoyal'},
{val: 365, name: 'Disco Killer Music Lover'}
]
each item in pacemaker_cover_types
option(value=item.val, selected=(custom.pacemaker_cover == item.val)) #{item.name}
@@ -1293,7 +1414,8 @@ div
{val: 20, name: 'CastHour'},
{val: 21, name: 'RESIDENT'},
{val: 22, name: 'EPOLIS'},
{val: 23, name: 'Pinky Crush'}
{val: 23, name: 'Pinky Crush'},
{val: 24, name: 'Sparkle Shower'}
]
each item in full_combo_splash_types
option(value=item.val, selected=(custom.full_combo_splash == item.val)) #{item.name}
@@ -1323,7 +1445,8 @@ div
{val: 16, name: 'CastHour'},
{val: 17, name: 'RESIDENT'},
{val: 18, name: 'EPOLIS'},
{val: 19, name: 'Pinky Crush'}
{val: 19, name: 'Pinky Crush'},
{val: 20, name: 'Sparkle Shower'}
]
each item in judge_font_types
option(value=item.val, selected=(custom.judge_font == item.val)) #{item.name}

View File

@@ -1829,7 +1829,133 @@ script.
"32109": "EYE OF THE HEAVEN",
"32110": "Plazma",
"32111": "キスキツネ",
"32112": "Good Looking"
"32112": "Good Looking",
"33000": "ビビッド ☆+*。キラキライム",
"33001": "かわいいだけじゃだめですか?",
"33002": "ラブコメトキドキシリアス",
"33003": "HEROES",
"33004": "Nemophila",
"33005": "BitRacer",
"33006": "chaplet -IIDX re:build-",
"33007": "Signs and Wonders",
"33008": "Countdown to Heaven or Hell",
"33009": "fixer",
"33010": "super double play sessions",
"33011": "クレッシェンド",
"33012": "Iridescent Memories",
"33013": "デラむぅのでらっくす☆どり~むぅ",
"33014": "Bloom",
"33015": "鏡像都市",
"33016": "A Certified Rave Moment",
"33017": "Substance",
"33018": "FiZZλ_PØT!0И",
"33019": "タンポポ",
"33020": "夏色のセレナーデ",
"33021": "From Human Blood",
"33022": "Space Battleship S4TØ",
"33023": "⁽⁽ଘ( ˙꒳˙ )ଓ⁾⁾ beyond reason",
"33024": "Makin' It",
"33026": "kors k's Let's make an Image Song!",
"33028": "Regina vespaE",
"33030": "voice of echo.",
"33031": "JUST SYNC ft.Kanae Asaba",
"33032": "Show Time",
"33033": "ベラ・ベ・カラベラ",
"33034": "D.K.N. ON",
"33035": "MOCHIMOCHI DREAMIN!!",
"33036": "Dolphin Kick",
"33037": "Hallucination",
"33038": "閃と雷管とロープ",
"33039": "Vitamin",
"33040": "RALLY '25",
"33041": "煉獄コンフィチュール",
"33042": "Limelight",
"33043": "月下繚乱",
"33044": "UNDO THE NIGHT",
"33045": "Bang Bang Dance",
"33046": "Dusk Endir",
"33047": "Memoria Obscura",
"33048": "Funky Quirky",
"33049": "PALETTE",
"33050": "Disco Killer Music Lover",
"33051": "PERFECT GREAT!!",
"33052": "Fashion Fruit",
"33053": "ベンガル vs. アムール Battle",
"33056": "BattleRoyal",
"33057": "好吃来世deエレクトリック",
"33058": "Lisa-RICCIA",
"33059": "じぇりー じゅえる ジャングル",
"33060": "Ignited Night",
"33061": "ιgniЯRuina",
"33062": "SnapSkipSpark",
"33063": "X-Plan",
"33064": "AGETEKE ONDO",
"33065": "サタデーナイト☆ギャロップ",
"33066": "Digitized Ocean",
"33067": "SPLASH!!!!!!!!!",
"33068": "Amor∞Fati",
"33069": "OMEGA",
"33070": "GOLD RUSH 2025",
"33071": "それが、ボクの使命~レスキュー隊長 メンキュー~",
"33072": "FIZZY FIZZY POP",
"33073": "2 Be Continued",
"33074": "Catch ya Getcha!",
"33075": "百恋ラブラスター",
"33076": "Begin",
"33077": "SHINING☆DANCE",
"33078": "Shooting Star",
"33081": "でんぱ どりる わんにゃー☆三",
"33082": "LEMON MELON COOKIE",
"33083": "もんめためたもん",
"33084": "バブリン",
"33085": "Caramel Pain",
"33086": "Nyan Nyan University ",
"33087": "GO!",
"33088": "HORIZON BEATZ",
"33089": "RIZING-GAMERS.",
"33090": "SILKY BRAVE",
"33091": "Astra Blaze",
"33092": "Meteor☆Shower",
"33093": "King of Tribe",
"33094": "COLOR BURST",
"33095": "不死身ごっこ",
"33096": "オーバーライド",
"33098": "Watermelon Explosion",
"33099": "REcorrection",
"33100": "TOKAKU=ALMiRAJ",
"33101": "色を喪った街",
"33102": "HyperTwist",
"33103": "Last Card",
"33104": "RUINA",
"33105": "華麗なる!音戯探偵ひなビタ♫",
"33106": "レシピのリドル",
"33107": "Skywalking",
"33108": "pique",
"33109": "Gimme a Big Beat(青龍 Remix)",
"33110": "Second Heaven(Mamonis Remix)",
"33111": "Kick The Rainbow",
"33112": "恋愛観測",
"33113": "Τέλος",
"33114": "ACID VISION",
"33115": "メテオラ-meteor-",
"33116": "Wizards!",
"33117": "THUNDERSTRIKE",
"33118": "blue anthem",
"33119": "Get Into The Groove feat.WaMi",
"33120": "ESPRIT ONE",
"33121": "Mighty Beat Monsterz",
"33122": "Smintheus",
"33123": "断罪のミメシス",
"33124": "Any%",
"33125": "キミとえがくキセキ",
"33126": "[E]",
"33127": "三日天下モンキー",
"33129": "夢色ワンダー",
"33130": "メルト CPK! Remix (初音ミク ver.)",
"33131": "Ex-Otogibanashi",
"33132": "9-1",
"33133": "霹靂",
"33333": "TUTORIAL"
};
-
@@ -1852,13 +1978,21 @@ div
p.card-header-title
span.icon
i.mdi.mdi-format-list-bulleted
| Score List (Pinky Crush)
.select.is-small
select(id="score-sort-filter")
option(value="recent") Recently Played
option(value="mid") Music ID
option(value="title") Music Title
option(value="lamp") Clear Lamp
| Score List
.field.is-grouped
.control
.select.is-small
select(id="score-sort-filter")
option(value="recent") Recently Played
option(value="mid") Music ID
option(value="title") Music Title
option(value="lamp") Clear Lamp
.control
.select.is-small
select(id="score-page-size")
option(value="10" selected) 10 per page
option(value="30") 30 per page
option(value="50") 50 per page
.card-content
table.table.is-striped.is-fullwidth.is-hoverable
thead
@@ -1868,7 +2002,7 @@ div
th Clear Lamp
th EX Score
th BP
tbody
tbody#score-table-body
each i in score
- for (let d = 0; d < 9; d++) {
- let lamp = i.cArray[d];
@@ -1876,7 +2010,7 @@ div
- let miss = i.mArray[d];
- if (lamp > 0 || ex > 0 || miss > -1) {
- const updateTime = i.updatedAt ? new Date(i.updatedAt).getTime() : 0;
- const updateTime = Array.isArray(i.playTimeArray) && Number(i.playTimeArray[d]) > 0 ? Number(i.playTimeArray[d]) : 0;
tr(data-mid=i.mid data-updated=updateTime data-lamp=lamp data-ex=ex)
//- A space for the title instead of the ID
td.music-title(data-mid=i.mid)
@@ -1890,9 +2024,28 @@ div
- }
- }
nav.pagination.is-small.is-centered(
role="navigation"
aria-label="pagination"
style="margin-top: 1rem;"
)
button#score-page-prev.button.is-small(
type="button"
disabled
) Previous
span#score-page-info(
style="display: flex; align-items: center; padding: 0 1rem;"
) Page 1 / 1
button#score-page-next.button.is-small(
type="button"
disabled
) Next
//- 3. run Title Replacement
script.
$(document).ready(function() {
let currentScorePage = 1;
let scorePageSize = 10;
// Cache music title text attributes for each row
$('tbody tr').each(function() {
const mid = String($(this).data('mid'));
@@ -1900,9 +2053,43 @@ script.
$(this).attr('data-title', title);
});
function renderScorePage() {
const $rows = $('#score-table-body').find('tr');
const totalRows = $rows.length;
const totalPages = Math.max(1, Math.ceil(totalRows / scorePageSize));
if (currentScorePage > totalPages) {
currentScorePage = totalPages;
}
if (currentScorePage < 1) {
currentScorePage = 1;
}
const startIndex = (currentScorePage - 1) * scorePageSize;
const endIndex = startIndex + scorePageSize;
$rows.hide();
$rows.slice(startIndex, endIndex).show();
$('#score-page-info').text(
'Page ' + currentScorePage + ' / ' + totalPages
);
$('#score-page-prev').prop(
'disabled',
currentScorePage <= 1
);
$('#score-page-next').prop(
'disabled',
currentScorePage >= totalPages
);
}
// Define sorting function
function sortScoreTable(sortType) {
const $tbody = $('tbody');
const $tbody = $('#score-table-body');
const $rows = $tbody.find('tr').get();
$rows.sort(function(a, b) {
@@ -1935,13 +2122,42 @@ script.
$.each($rows, function(index, row) {
$tbody.append(row);
});
renderScorePage();
}
// Execute default sort (Recently Played) and bind change event
sortScoreTable($('#score-sort-filter').val());
$('#score-sort-filter').on('change', function() {
currentScorePage = 1;
sortScoreTable($(this).val());
});
$('#score-page-size').on('change', function() {
scorePageSize = Number($(this).val()) || 10;
currentScorePage = 1;
renderScorePage();
});
$('#score-page-prev').on('click', function() {
if (currentScorePage <= 1) return;
currentScorePage -= 1;
renderScorePage();
});
$('#score-page-next').on('click', function() {
const totalRows = $('#score-table-body').find('tr').length;
const totalPages = Math.max(
1,
Math.ceil(totalRows / scorePageSize)
);
if (currentScorePage >= totalPages) return;
currentScorePage += 1;
renderScorePage();
});
$('.music-title').each(function() {
const $cell = $(this);
const mid = String($cell.data('mid'));

70
otoca@asphyxia/README.md Normal file
View File

@@ -0,0 +1,70 @@
# otoca d'or
Plugin Version: **v0.3.0**
---
Supported Versions
- otoca d'or (NCG:J:A:A:2019012900)
---
How it works
- The game's network code lives in `modules/ealocal.dll`. It sends XRPC module `game` on service `local`
(the `local` URL comes from CORE's `services.get`). Every field name, node type and array limit here
follows the psmap tables in that DLL, and every value follows how game.dll uses it.
- Players are identified by the printed cards, not by an e-amusement pass:
- `game.addUser` creates the player and the first doll (level 1, the doll's starting equipment).
- `game.setCardInfo` prints a card. The server issues its `otocard_id` (8 characters of
`0123456789ABCDEFGHJKLMNPRSTUWXYZ`), which the game packs into the card's QR code, and rolls the
kira bonus printed on it.
- Scanning a card sends `game.getCardInfo` with that id and gets the player, the latest doll in the
coord printed on that card, the closet and that card's kira bonus back. An unknown card answers
status 1, and the game then plays offline.
- The key card (`game.bindKeyUser`) is a second printed card tied to the player. Once a key is bound,
scanning a card asks for the key card (`game.checkKeyUser`) and the closet holds 999 items instead of 50.
- `game.getVersion` and getCardInfo both send episode 5 and a phase from 7 to 11. Those phases unlock the
same content and differ only in the rival card pack (and its icon on the title screen).
- Without a camera, printed card images can be scanned with a hook that feeds an image to the game's
camera library (libcamera.dll) in place of the camera frame.
Code layout
- `index.ts`: settings and routes. `handlers/`: one file per part of the game (version, card, key,
print, play, item, gift). `models/`: the stored documents (user, doll, card, counter).
- `closet.ts`: adding and removing items, and the closet's response nodes. `player.ts`: new players
and dolls. `db.ts`: ids and reads/writes. `data.ts`: values from the game's data. `utils.ts`: helpers.
Settings
- Version marker: unlocks hair/eye colours in the salon and the mode-select tips (the game checks 1 to 8).
- Salon trial ticket: one free hair/eye colour change for each player (on by default, as in the arcade).
- Limited-time enemy: shows the one limited-time enemy the data has (episode 3).
- Double stamps: two stamps per play.
- Free star kira: star kira cards need no star powder.
- Rival card pack: the pack the rival cards offered after a play come from, one of the five packs or
Random (a new draw for each play). The game takes the pack from the version it got when the card
was scanned; plays without a scan (new players) use the one from the attract loop.
Server-side rules (from the arcade as documented by the fan wiki and the official site)
- Kira cards give +1 to 1-3 random stats.
- Accessories vary per piece: stats 60-80% (N), 70-90% (R), 80-100% (SR) of the base, skills likewise.
- One stamp per play; a full card of 10 gives one star powder. New players start with one powder
and the first rival card ticket. The first key card comes with the Pink March Ribbon.
- "New doll" unlocks once any doll reaches level 5.
- Nyandora's 8 letters are missions 2-9 (mission 1 is the first play). The 8th letter completes the
wallpaper (card_bg 0018, the one the game's letter data shows), and then the missions end.
- No questionnaires, and old campaign gift cards answer "expired". The game's own offline card
(printed when setCardInfo fails) gives its apology gift and a stamp once.
Not done yet
- No WebUI.
---
Changelog
- 0.3.0: rules checked against the fan wiki and the official site: kira +1 to 1-3 stats, accessory
variance per grade, each card keeps its printed coord, first-key ribbon, offline-card stamp,
letter wallpaper, salon trial ticket.
- 0.2.0: every response rebuilt from a full analysis of game.dll (starting equipment, doll seed range,
key card binding, per-card kira, stamp card of 10, missions, closet rules for accessories, selling
and discarding).
- 0.1.0: first version.

70
otoca@asphyxia/closet.ts Normal file
View File

@@ -0,0 +1,70 @@
// The player's closet: equips, materials, deco seals and accessories, and their response nodes.
import { ACCESSORY_IDS, ACCESSORY_OFFSET } from './data';
import { saveDoll } from './db';
import { Doll } from './models/doll';
import { Accessory, User } from './models/user';
import { log, rand, u8, u32 } from './utils';
export const isAccessory = (type: number, id: number) =>
type === 0 && ACCESSORY_IDS.some(([a, b]) => id >= a && id <= b);
export function addCount(bag: { [id: string]: number[] }, id: number, grade: number, n: number) {
if (!id || grade > 2) return;
const gr = bag[id] || [0, 0, 0];
gr[grade] = Math.max(0, gr[grade] + n);
if (gr.some(c => c > 0)) bag[id] = gr;
else delete bag[id];
}
export function makeAccessory(u: User, id: number, grade: number): Accessory {
const gr = Math.min(grade, 2);
const a = { aseq: u.next_aseq++, id, gr, offset: ACCESSORY_OFFSET[gr].map(([lo, hi]) => lo + rand(hi - lo + 1)) };
u.accessory.push(a);
return a;
}
// item_type 0 equip (kind 4 = accessory), 1 material, 2 decoseal. Returns the accessory made, if any.
export function giveItem(u: User, type: number, id: number, grade: number): Accessory | null {
if (isAccessory(type, id)) return makeAccessory(u, id, grade);
if (type === 0) addCount(u.equip, id, grade, 1);
else if (type === 1) addCount(u.material, id, grade, 1);
else if (type === 2 && id) u.decoseal[id] = (u.decoseal[id] || 0) + 1;
else log(`unknown item type=${type} id=${id} grade=${grade}`, {});
return null;
}
async function removeAccessory(u: User, aseq: number) {
u.accessory = u.accessory.filter(a => a.aseq !== aseq);
// the game also takes a removed accessory off the doll wearing it
for (const d of await DB.Find<Doll>({ collection: 'doll', user_seq: u.user_seq })) {
if (d.accessory.includes(aseq)) {
d.accessory = d.accessory.map(s => (s === aseq ? 0 : s));
await saveDoll(d);
}
}
}
export async function takeItem(u: User, aseq: number, type: number, id: number, grade: number, n: number) {
if (aseq) await removeAccessory(u, aseq);
else if (type === 0) addCount(u.equip, id, grade, -n);
else if (type === 1) addCount(u.material, id, grade, -n);
}
export const EMPTY_ACCESSORY: Accessory = { aseq: 0, id: 0, gr: 0, offset: [0, 0, 0, 0] };
export const accessoryNode = (a: Accessory) => ({
accessory_seq: u32(a.aseq), equip_id: u32(a.id), equip_grade: u8(a.gr),
param_offset: u8(a.offset[0]), skill_offset_1: u8(a.offset[1]),
skill_offset_2: u8(a.offset[2]), skill_offset_3: u8(a.offset[3]),
});
// compact form (getCardInfo ver="1"): one <i> per id, gr[g] = count of grade g, -1 = none
export const gradeList = (bag: { [id: string]: number[] }) =>
Object.keys(bag).map(id => ({ id: u32(+id), gr: K.ARRAY('s16', bag[id].map(c => (c > 0 ? c : -1))) }));
// The game counts accessories in the equip list as well (AddAccessory adds to both).
export function equipWithAccessories(u: User) {
const bag: { [id: string]: number[] } = {};
for (const id of Object.keys(u.equip)) bag[id] = u.equip[id].slice();
for (const a of u.accessory) addCount(bag, a.id, a.gr, 1);
return bag;
}

38
otoca@asphyxia/data.ts Normal file
View File

@@ -0,0 +1,38 @@
// Values taken from the game's data (data_ncg/paramdb) and the arcade's rules.
// versiondata.csv: base 5-2, newest 5-11. 5-6 to 5-11 unlock the same content; only the rival card pack
// (rivalcard_packdata.csv: the last row at or below the version) and its title-screen icon differ,
// so the phase picks the pack.
export const EPISODE = 5;
export const RIVAL_PACKS = [
{ name: 'ジュエル・ソング', phase: 7 },
{ name: 'ミッドサマーナイト・ドリーム', phase: 8 },
{ name: 'スターズ・シャイニング', phase: 9 },
{ name: 'ファイアリー・エンジェル', phase: 10 },
{ name: 'レ・フェニーチ', phase: 11 },
];
// Alphabet of the ids the game packs into its QR codes (5 bits per char).
export const ID_CHARS = '0123456789ABCDEFGHJKLMNPRSTUWXYZ';
// equipdata.csv rows with kind 4 (accessories): they carry an accessory_seq.
export const ACCESSORY_IDS: number[][] = [
[41, 52], [144, 203], [206, 212], [293, 347], [351, 356], [360, 361], [365, 366],
[470, 531], [535, 536], [584, 609], [619, 626], [648, 664], [696, 720], [731, 740],
];
// dollinitdata.csv: starting equips (weapon, top, bottom, shoes) per doll_id.
export const DOLL_INIT: { [doll_id: number]: number[] } = {
1: [9, 18, 29, 40], 2: [9, 20, 31, 40], 3: [9, 17, 28, 40],
4: [9, 19, 30, 40], 5: [9, 21, 32, 40], 6: [9, 409, 438, 40],
};
// Accessory stat / skill 1-3 percent ranges per grade N, R, SR (wiki item list: accessories vary per piece).
export const ACCESSORY_OFFSET = [
[[60, 80], [80, 100], [50, 100], [0, 0]],
[[70, 90], [100, 100], [80, 100], [40, 50]],
[[80, 100], [100, 100], [100, 100], [80, 100]],
];
export const FIRST_KEY_ACCESSORY = 144; // ピンクマーチリボン, made in the tailor tutorial when the first key is made
// cardbg.csv 29 = card_bg 0018 (Nyandora's night sky), the wallpaper afp_letter.ifs completes; no release table
// unlocks it, so it only comes through closet/cardbg.
export const LETTER_WALLPAPER = 29;
export const LAST_MISSION = 9; // the 8th letter
export const TEMP_ASEQ = 1000000000; // the game's own placeholder seqs for this play's drops (sell scene)
export const MAX_BALANCE = 9999999;

36
otoca@asphyxia/db.ts Normal file
View File

@@ -0,0 +1,36 @@
import { ID_CHARS } from './data';
import { Card } from './models/card';
import { Counter } from './models/counter';
import { Doll } from './models/doll';
import { User } from './models/user';
import { rand } from './utils';
export async function nextSeq(name: string) {
const c = await DB.FindOne<Counter>({ collection: 'counter', name });
const value = (c ? c.value : 0) + 1;
await DB.Upsert<Counter>({ collection: 'counter', name }, { $set: { value } });
return value;
}
// ponytail: random ids with a uniqueness check, fine for a home server's card count.
export async function newId() {
for (;;) {
let id = '';
for (let i = 0; i < 8; i++) id += ID_CHARS[rand(ID_CHARS.length)];
if (id === '00000000') continue;
const used = (await DB.Count<Card>({ collection: 'card', otocard_id: id })) +
(await DB.Count<User>({ collection: 'user', keycard_id: id }));
if (!used) return id;
}
}
export const getUser = (user_seq: number) => DB.FindOne<User>({ collection: 'user', user_seq });
export const getDoll = (doll_seq: number) => DB.FindOne<Doll>({ collection: 'doll', doll_seq });
export const getCard = (otocard_id: string) => DB.FindOne<Card>({ collection: 'card', otocard_id });
async function save(key: object, doc: object) {
const { _id, ...rest } = doc as any;
await DB.Update(key, { $set: rest });
}
export const saveUser = (u: User) => save({ collection: 'user', user_seq: u.user_seq }, u);
export const saveDoll = (d: Doll) => save({ collection: 'doll', doll_seq: d.doll_seq }, d);

View File

@@ -0,0 +1,93 @@
// New players and dolls, and scanning a printed card.
import { accessoryNode, equipWithAccessories, gradeList } from '../closet';
import { EPISODE } from '../data';
import { getCard, getDoll, getUser, nextSeq, saveUser } from '../db';
import { greeting, newDoll, newUser } from '../player';
import { bool, log, now, u8, u32 } from '../utils';
import { phase } from './version';
export const addUser: EPR = async (info, data, send) => {
const u = newUser(await nextSeq('user'), $(data).str('user_name', ''));
const d = await newDoll(u, $(data).number('doll_id', 0), $(data).str('doll_name', ''));
await DB.Insert(u);
send.object({
user_seq: u32(u.user_seq),
doll_seq: u32(d.doll_seq),
doll_seed: u32(d.doll_seed),
powder_num: u32(u.powder_num),
stamp_num: u32(u.stamp_num),
mission_no: u8(u.mission_no),
question_id: u8(u.question_id),
ticket_rc_first: bool(u.ticket_rc_first),
});
};
export const addDoll: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.deny();
const d = await newDoll(u, $(data).number('doll_id', 0), $(data).str('doll_name', ''));
await saveUser(u);
send.object({ doll_seq: u32(d.doll_seq), doll_seed: u32(d.doll_seed) });
};
export const getCardInfo: EPR = async (info, data, send) => {
const otocard_id = $(data).str('otocard_id', '');
const card = await getCard(otocard_id);
const u = card && (await getUser(card.user_seq));
const d = card && (await getDoll(card.doll_seq));
if (!u || !d) {
// status 1: the game plays offline with what the QR holds
log(`getCardInfo: unknown card ${otocard_id}`, {});
return send.deny();
}
const worn = card.accessory;
send.object({
user_seq: u32(u.user_seq),
user_name: K.ITEM('str', u.user_name),
doll_seq: u32(d.doll_seq),
doll_id: u32(d.doll_id),
doll_name: K.ITEM('str', d.doll_name),
doll_level: u32(d.doll_level),
doll_seed: u32(d.doll_seed),
locked: bool(!!u.keycard_id), // tied to a key card: reads the key next, closet limit 999
luck_offset: u32(d.luck_offset),
equip: [...card.equip, ...worn.map(a => [a.id, a.gr])].map(e => ({ equip_id: u32(e[0]), equip_grade: u8(e[1]) })),
accessory: worn.map(accessoryNode),
score: {
release_state: u32(u.release_state),
stamp_conv_num: u32(u.stamp_conv_num),
user_flags: K.ARRAY('u8', u.user_flags),
last_time: K.ITEM('time', u.last_time),
curr_time: K.ITEM('time', now()),
greeting_level: u8(greeting(u.last_time)),
user_marker: u8(u.user_marker),
mission_no: u8(u.mission_no),
setting: { sort_type: u8(u.sort_type), disp_skill: u8(u.disp_skill) },
question_id: u8(u.question_id),
enemy: u.enemy.map(e => ({ enemy_team_id: u32(e[0]), enemy_team_level: u32(e[1]) })),
last_enemy: u.last_enemy.map(e => ({ episode: u8(e[0]), enemy_team_id: u32(e[1]), enemy_team_level: u32(e[2]) })),
enemy_detail: { i: Object.keys(u.friendly).map(t => ({ id: K.ITEM('u16', +t), pt: u32(u.friendly[t]) })) },
},
// the bonus printed on this card; the game applies it to one battle
offset: { kira_hp: u8(card.kira[0]), kira_atk: u8(card.kira[1]), kira_mat: u8(card.kira[2]), kira_spd: u8(card.kira[3]) },
active_key: bool(!!u.keycard_id),
version: { episode: u8(EPISODE), phase: u8(phase()) },
makeup: { hair_color: u8(d.makeup[0]), eye_color: u8(d.makeup[1]) },
closet: {
powder_num: u32(u.powder_num),
stamp_num: u32(u.stamp_num),
wallet: {
balance: u32(u.balance),
ticket_half_price: bool(u.ticket_half_price),
ticket_rc_first: bool(u.ticket_rc_first),
},
equip: { i: gradeList(equipWithAccessories(u)) },
material: { i: gradeList(u.material) },
decoseal: Object.keys(u.decoseal).slice(0, 1).map(id => ({ decoseal_id: u32(+id), decoseal_num: u32(u.decoseal[id]) })),
accessory: {
i: u.accessory.map(a => ({ aseq: u32(a.aseq), id: u32(a.id), gr: u8(a.gr), offset: K.ARRAY('u8', a.offset) })),
},
cardbg: u.cardbg.slice(0, 4).map(id => ({ id: u8(id) })),
},
});
};

View File

@@ -0,0 +1,21 @@
// Gift QRs scanned after the doll card.
import { getUser } from '../db';
import { u8, u32 } from '../utils';
// Only type 4 (the offline card the game prints when setCardInfo fails) is honoured.
// The apology gift itself is taken later by addItem with gift_type 4. Past campaigns answer 5 (expired).
export const receiveGift: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
const gift = $(data).element('info');
const type = gift ? gift.number('gift_type', 0) : 0;
const code = gift ? gift.str('gift_code', '') : '';
const status = type !== 4 ? 5 : u && u.gifts_used.includes(code) ? 2 : 1;
send.object({
powder_num: u32(u ? u.powder_num : 0), // always overwrites the game's count
status: [{ gift_type: u8(type), gift_status: u8(status) }],
});
};
export const receiveItem: EPR = async (info, data, send) => {
send.object({ gift_type: u8(7), gift_status: u8(5) });
};

View File

@@ -0,0 +1,84 @@
// Closet changes: drops, discarding, selling, the tailor and the salon.
import { accessoryNode, EMPTY_ACCESSORY, giveItem, isAccessory, takeItem } from '../closet';
import { MAX_BALANCE, TEMP_ASEQ } from '../data';
import { getDoll, getUser, saveDoll, saveUser } from '../db';
import { Accessory } from '../models/user';
import { u32 } from '../utils';
export const addItem: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.deny();
// accessory[i] must line up with item[i]; rows that are not accessories stay zero
const made = $(data).elements('item').map(i =>
giveItem(u, i.number('item_type', 0), i.number('item_id', 0), i.number('item_grade', 0)) || EMPTY_ACCESSORY);
const gift = $(data).str('gift_code', '');
// gift_type 4: the present for an offline card, which also gives one stamp (official notice)
if ($(data).number('gift_type', 0) === 4 && gift && !u.gifts_used.includes(gift)) {
u.gifts_used.push(gift);
u.stamp_bonus++;
}
await saveUser(u);
send.object({ accessory: made.map(accessoryNode) });
};
// item: what the player threw away (one row per piece). drop: this play's drops that are kept.
export const delItem: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.deny();
for (const i of $(data).elements('drop')) giveItem(u, i.number('item_type', 0), i.number('item_id', 0), i.number('item_grade', 0));
for (const i of $(data).elements('item')) {
await takeItem(u, i.number('accessory_seq', 0), i.number('item_type', 0), i.number('item_id', 0), i.number('item_grade', 0), 1);
}
await saveUser(u);
send.success();
};
export const sellItem: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.deny();
const items = $(data).elements('item');
const soldTemp = items.map(i => i.number('accessory_seq', 0)).filter(s => s >= TEMP_ASEQ);
// drops first (sell scene after a full closet): a dropped accessory sold right away comes back as TEMP_ASEQ + n
const made: Accessory[] = [];
$(data).elements('drop').forEach((i, n) => {
const type = i.number('item_type', 0), id = i.number('item_id', 0), grade = i.number('item_grade', 0);
if (isAccessory(type, id) && soldTemp.includes(TEMP_ASEQ + n)) return;
const a = giveItem(u, type, id, grade);
if (a) made.push(a);
});
for (const i of items) {
const aseq = i.number('accessory_seq', 0);
if (aseq >= TEMP_ASEQ) continue;
await takeItem(u, aseq, i.number('item_type', 0), i.number('item_id', 0), i.number('item_grade', 0), i.number('item_num', 1));
}
// the game computes the balance after selling (prices from pricelist.csv) and never reads ours
u.balance = Math.max(0, Math.min(MAX_BALANCE, $(data).number('balance', u.balance)));
await saveUser(u);
send.object({ balance: u32(u.balance), accessory: made.map(accessoryNode) });
};
export const composition: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.deny();
for (const k of ['item_in_1', 'item_in_2']) {
const i = $(data).element(k);
if (i) await takeItem(u, i.number('accessory_seq', 0), i.number('item_type', 0), i.number('item_id', 0), i.number('item_grade', 0), 1);
}
const r = $(data).element('item_result');
const made = r ? giveItem(u, r.number('item_type', 0), r.number('item_id', 0), r.number('item_grade', 0)) : null;
await saveUser(u);
send.object({ accessory: accessoryNode(made || EMPTY_ACCESSORY) });
};
export const setMakeup: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
const d = await getDoll($(data).number('doll_seq'));
if (!u || !d) return send.deny();
d.makeup = [$(data).number('makeup.hair_color', 0), $(data).number('makeup.eye_color', 0)];
// payment is only the last purchase; the game sends the balance after paying
u.balance = Math.max(0, Math.min(MAX_BALANCE, $(data).number('balance', u.balance)));
if ($(data).number('ticket_type', 0) === 1) u.ticket_half_price = false;
await saveDoll(d);
await saveUser(u);
send.object({ balance: u32(u.balance) });
};

View File

@@ -0,0 +1,31 @@
// The key card (ニャンドラのカギ): a second printed card tied to the player.
import { accessoryNode, EMPTY_ACCESSORY, makeAccessory } from '../closet';
import { FIRST_KEY_ACCESSORY } from '../data';
import { getUser, newId, saveUser } from '../db';
import { log } from '../utils';
export const checkKeyUser: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
const keycard_id = $(data).str('keycard_id', '');
if (!u || !u.keycard_id || u.keycard_id !== keycard_id) {
log('checkKeyUser: not this user\'s key', { keycard_id, bound: u && u.keycard_id });
return send.status(10); // the game shows "key does not match" and lets the player rescan
}
send.object({ keycard_id: K.ITEM('str', u.keycard_id), key_inquire_id: K.ITEM('str', u.key_inquire_id) });
};
// A new key replaces the old one (first key or "remake"). The id goes into the key card's QR.
export const bindKeyUser: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.deny();
u.keycard_id = await newId();
u.key_inquire_id = await newId();
// the first key comes with the tailor tutorial's result; the game adds it only when is_first is set
const bonus = $(data).bool('is_first') ? makeAccessory(u, FIRST_KEY_ACCESSORY, 0) : EMPTY_ACCESSORY;
await saveUser(u);
send.object({
keycard_id: K.ITEM('str', u.keycard_id),
key_inquire_id: K.ITEM('str', u.key_inquire_id),
accessory: accessoryNode(bonus),
});
};

View File

@@ -0,0 +1,89 @@
// What a play reports: battle results, gold and friend points, stamps, letters and questionnaires.
import { LAST_MISSION, LETTER_WALLPAPER, MAX_BALANCE } from '../data';
import { getDoll, getUser, saveDoll, saveUser } from '../db';
import { updateRelease } from '../player';
import { now, u32 } from '../utils';
export const report: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.success();
const b = $(data).element('battle');
if (b) {
const team = b.number('enemy_team_id', 0);
const level = b.number('enemy_team_level', 0);
const episode = b.number('episode', 0);
// battle_result 0 win, 1 lose, 2 draw; the game adds a beaten pair to score/enemy only on a win
if (team && b.number('battle_result', 1) === 0 && u.enemy.length < 200 &&
!u.enemy.some(e => e[0] === team && e[1] === level)) u.enemy.push([team, level]);
if (team) u.last_enemy = [[episode, team, level], ...u.last_enemy.filter(e => e[0] !== episode)].slice(0, 6);
}
u.user_flags = $(data).numbers('user_flags', u.user_flags);
u.user_marker = $(data).number('user_marker', u.user_marker);
u.sort_type = $(data).number('setting.sort_type', u.sort_type);
u.disp_skill = $(data).number('setting.disp_skill', u.disp_skill);
u.last_time = now();
const d = await getDoll($(data).number('doll_seq'));
if (d && d.user_seq === u.user_seq) {
d.doll_level = Math.max(1, Math.min(31, $(data).number('doll_level', d.doll_level)));
await saveDoll(d);
}
await updateRelease(u);
await saveUser(u);
send.success();
};
// Only gold and friend points: doll levels are raised by the game itself.
export const addExp: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.deny();
u.balance = Math.min(MAX_BALANCE, u.balance + $(data).number('gold.add_amount', 0));
const team = $(data).number('friendly.enemy_team_id', 0);
if (team) u.friendly[team] = (u.friendly[team] || 0) + $(data).number('friendly.add_point', 0);
await saveUser(u);
send.object({ balance: u32(u.balance), friend_point: u32(team ? u.friendly[team] : 0) });
};
// The stamp card has 10 squares; a full card turns into star powder.
export const addStamp: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (!u) return send.deny();
// one stamp per play (official), plus stamps from gifts; the game animates old -> after one by one
const after = u.stamp_num + (U.GetConfig('stamp_double') ? 2 : 1) + u.stamp_bonus;
u.stamp_bonus = 0;
const full = Math.floor(after / 10);
u.stamp_num = after % 10;
u.powder_num += full; // one powder per full card (official)
u.stamp_conv_num += full;
await saveUser(u);
send.object({
powder_num: u32(u.powder_num),
stamp_num: u32(u.stamp_num),
stamp_conv_rate: u32(10), // squares per card; the game divides by it
stamp_after_num: u32(after),
});
};
// Missions: 1 is the first play (always done, no letter); 2-9 are Nyandora's 8 letters, each checked against the
// flag the previous number records (game.dll FUN_100219c0); finishing 9 completes the wallpaper. The game only
// reports and never advances mission_no itself, and anything above 9 means no mission.
export const reportMission: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
const n = $(data).number('mission_no', 0);
if (u && n >= 1 && n <= LAST_MISSION && u.mission_no === n) {
u.mission_no = n + 1;
// the 8th letter: the original wallpaper (closet/cardbg adds to the wallpapers the game offers)
if (n === LAST_MISSION && !u.cardbg.includes(LETTER_WALLPAPER) && u.cardbg.length < 4) u.cardbg.push(LETTER_WALLPAPER);
await saveUser(u);
}
send.success();
};
// score/question_id is the questionnaire still to show; no questionnaires are offered, so it stays 0.
export const reportQuestion: EPR = async (info, data, send) => {
const u = await getUser($(data).number('user_seq'));
if (u) {
u.question_id = 0;
await saveUser(u);
}
send.success();
};

View File

@@ -0,0 +1,56 @@
// Printing doll cards and rival cards.
import { EMPTY_ACCESSORY } from '../closet';
import { getCard, getDoll, getUser, newId, saveDoll, saveUser } from '../db';
import { Card } from '../models/card';
import { updateRelease } from '../player';
import { log, now, rand, u8 } from '../utils';
export const setCardInfo: EPR = async (info, data, send) => {
const d = await getDoll($(data).number('doll_seq'));
const u = d && (await getUser(d.user_seq));
if (!u || !d) return send.deny();
d.doll_level = Math.max(1, Math.min(31, $(data).number('doll_level', d.doll_level)));
d.doll_name = $(data).str('doll_name', d.doll_name);
d.equip = $(data).elements('equip').slice(0, 4).map(e => [e.number('equip_id', 0), e.number('equip_grade', 0)]);
d.accessory = ($(data).numbers('accessory_seq') || []).concat([0, 0]).slice(0, 2);
await saveDoll(d);
// kira_type 0 normal, 1 star, 2 gold, 3 star while starkira_free is on.
// A kira card gives +1 to 1-3 random stats (wiki); the card shows each as one digit.
const kira_type = $(data).number('kira_type', 0);
const kira = [0, 0, 0, 0];
if (kira_type) for (const k of [0, 1, 2, 3].sort(() => Math.random() - 0.5).slice(0, 1 + rand(3))) kira[k] = 1;
if (kira_type === 1) u.powder_num = Math.max(0, u.powder_num - 1); // the game spends one star powder locally
const decoseal_id = $(data).number('decoseal_id', 0);
if (decoseal_id && u.decoseal[decoseal_id]) u.decoseal[decoseal_id]--; // guess: nothing else reports it
await updateRelease(u);
await saveUser(u);
// Snapshot the worn accessories. One sold since comes from the card this play started with.
const from_otocard_id = $(data).str('otocard_id', '');
const from = from_otocard_id ? await getCard(from_otocard_id) : null;
const accessory = d.accessory.map(s => (s && (u.accessory.find(a => a.aseq === s) ||
(from && from.accessory.find(a => a.aseq === s)))) || EMPTY_ACCESSORY);
const card: Card = {
collection: 'card', otocard_id: await newId(), inquire_id: await newId(), user_seq: u.user_seq,
doll_seq: d.doll_seq, kira_type, kira, equip: d.equip, accessory, decoseal_id, from_otocard_id, created: now(),
};
await DB.Insert(card);
log('setCardInfo', { otocard_id: card.otocard_id, kira_type, kira });
send.object({
otocard_id: K.ITEM('str', card.otocard_id),
inquire_id: K.ITEM('str', card.inquire_id),
offset: { kira_hp: u8(kira[0]), kira_atk: u8(kira[1]), kira_mat: u8(kira[2]), kira_spd: u8(kira[3]) },
});
};
// The game spends ticket_rc_first itself when a rival card is chosen and tells nobody else.
export const setRivalCard: EPR = async (info, data, send) => {
const card = await getCard($(data).str('otocard_id', ''));
const u = card && (await getUser(card.user_seq));
if (u && u.ticket_rc_first) {
u.ticket_rc_first = false;
await saveUser(u);
}
send.success();
};

View File

@@ -0,0 +1,29 @@
import { EPISODE, RIVAL_PACKS } from '../data';
import { bool, rand, u8, u32 } from '../utils';
// The phase of the configured rival card pack ("Random" draws one on every call). The game picks the pack
// from the version it holds when the card choice opens: getCardInfo's sets it for that play, getVersion's
// for plays without a card scan (new players) and for the pack icon on the title screen.
export function phase() {
const pack = RIVAL_PACKS.find(p => p.name === U.GetConfig('rival_pack'));
return (pack || RIVAL_PACKS[rand(RIVAL_PACKS.length)]).phase;
}
// Sent by ealocal every `expire` seconds from the attract loop; the game waits for the first one at boot.
export const getVersion: EPR = async (info, data, send) => {
const limited = U.GetConfig('limited_enemy') ? 1 : 0;
send.object({
expire: u32(600),
episode: u8(EPISODE),
phase: u8(phase()),
marker: u8(U.GetConfig('marker')),
campaign: {
trial_play: bool(false),
trial_shop: bool(U.GetConfig('trial_shop')), // one free salon try per player; the game keeps the flag
starkira_free: bool(U.GetConfig('starkira_free')),
stamp_double: bool(U.GetConfig('stamp_double')),
limited_enemy: K.ARRAY('bool', [0, 0, limited, 0, 0, 0, 0, 0]), // only slot 2 has an enemy (team 63)
},
question: { id: u8(0), reward: { type: u8(0), id: u32(0), grade: u8(0) } },
});
};

91
otoca@asphyxia/index.ts Normal file
View File

@@ -0,0 +1,91 @@
// otoca d'or (NCG). The XRPC module "game" (service "local") is implemented by the game's ealocal.dll;
// field names, types and limits follow its psmap tables, and every value follows how game.dll uses it
// (see README). Values marked "guess" are server policy the game code does not decide.
import { RIVAL_PACKS } from './data';
import { addDoll, addUser, getCardInfo } from './handlers/card';
import { receiveGift, receiveItem } from './handlers/gift';
import { addItem, composition, delItem, sellItem, setMakeup } from './handlers/item';
import { bindKeyUser, checkKeyUser } from './handlers/key';
import { addExp, addStamp, report, reportMission, reportQuestion } from './handlers/play';
import { setCardInfo, setRivalCard } from './handlers/print';
import { getVersion } from './handlers/version';
export function register() {
R.GameCode('NCG');
R.Contributor('iamsub');
R.Config('marker', {
name: 'Version marker',
desc: 'Unlocks hair/eye colours in the salon and mode-select tips (the game checks 1-8).',
type: 'integer',
default: 8,
range: [0, 255],
});
R.Config('limited_enemy', {
name: 'Limited-time enemy',
desc: 'Show the limited-time enemy (あい / ぷっちコンテスト, episode 3).',
type: 'boolean',
default: false,
});
R.Config('stamp_double', {
name: 'Double stamps',
desc: 'Two stamps per play, with the campaign icon on the title screen.',
type: 'boolean',
default: false,
});
R.Config('trial_shop', {
name: 'Salon trial ticket',
desc: 'One free hair/eye colour change in the salon for each player (as in the arcade).',
type: 'boolean',
default: true,
});
R.Config('rival_pack', {
name: 'Rival card pack',
desc: 'The pack the rival cards offered after a play come from. Random draws one for each play.',
type: 'string',
options: ['Random', ...RIVAL_PACKS.map(p => p.name)],
default: 'Random',
});
R.Config('starkira_free', {
name: 'Free star kira',
desc: 'Star kira cards need no star powder.',
type: 'boolean',
default: false,
});
R.Route('game.getVersion', getVersion);
R.Route('game.addUser', addUser);
R.Route('game.addDoll', addDoll);
R.Route('game.getCardInfo', getCardInfo);
R.Route('game.cancel', true);
R.Route('game.checkKeyUser', checkKeyUser);
R.Route('game.bindKeyUser', bindKeyUser);
R.Route('game.copyKeyCard', true);
R.Route('game.setCardInfo', setCardInfo);
R.Route('game.setRivalCard', setRivalCard);
R.Route('game.checkRivalCard', true);
R.Route('game.report', report);
R.Route('game.addExp', addExp);
R.Route('game.addStamp', addStamp);
R.Route('game.reportMission', reportMission);
R.Route('game.reportQuestion', reportQuestion);
R.Route('game.reportTrial', true);
R.Route('game.addItem', addItem);
R.Route('game.delItem', delItem);
R.Route('game.sellItem', sellItem);
R.Route('game.composition', composition);
R.Route('game.setMakeup', setMakeup);
R.Route('game.receiveGift', receiveGift);
R.Route('game.receiveItem', receiveItem);
R.Unhandled(async (info, data, send) => {
console.error(`[otoca] unhandled ${info.module}.${info.method}: ${JSON.stringify(data)}`);
send.success();
});
}

View File

@@ -0,0 +1,18 @@
import { Accessory } from './user';
export interface Card {
collection: 'card';
otocard_id: string;
inquire_id: string;
user_seq: number;
doll_seq: number;
kira_type: number;
kira: number[]; // hp, atk, mat, spd bonus printed on this card
// the coord printed on this card: scanning an old card plays the latest doll in that card's coord,
// even with items sold since then
equip: number[][];
accessory: Accessory[];
decoseal_id: number;
from_otocard_id: string;
created: number;
}

View File

@@ -0,0 +1,5 @@
export interface Counter {
collection: 'counter';
name: string;
value: number;
}

View File

@@ -0,0 +1,13 @@
export interface Doll {
collection: 'doll';
doll_seq: number;
user_seq: number;
doll_id: number;
doll_name: string;
doll_seed: number;
doll_level: number;
equip: number[][]; // 4 slots [equip_id, grade]: weapon, top, bottom, shoes
accessory: number[]; // 2 slots of accessory_seq, 0 = empty
makeup: number[]; // hair_color, eye_color
luck_offset: number;
}

View File

@@ -0,0 +1,39 @@
export interface Accessory {
aseq: number;
id: number;
gr: number;
offset: number[]; // param_offset, skill_offset_1..3 (percent of the equip's base values)
}
export interface User {
collection: 'user';
user_seq: number;
user_name: string;
keycard_id: string;
key_inquire_id: string;
powder_num: number;
stamp_num: number;
stamp_conv_num: number;
stamp_bonus: number; // stamps from gifts, pressed with the next addStamp
balance: number;
ticket_half_price: boolean;
ticket_rc_first: boolean;
equip: { [id: string]: number[] }; // count per grade 0..2, accessories not included
material: { [id: string]: number[] };
decoseal: { [id: string]: number };
accessory: Accessory[];
next_aseq: number;
cardbg: number[];
release_state: number;
user_flags: number[];
last_time: number;
user_marker: number;
mission_no: number;
question_id: number;
sort_type: number;
disp_skill: number;
enemy: number[][]; // [team, level] of every team/level beaten
last_enemy: number[][]; // [episode, team, level], newest first
friendly: { [team: string]: number };
gifts_used: string[];
}

48
otoca@asphyxia/player.ts Normal file
View File

@@ -0,0 +1,48 @@
// Creating players and dolls, and the per-player state the game only reads.
import { addCount } from './closet';
import { DOLL_INIT } from './data';
import { nextSeq } from './db';
import { Doll } from './models/doll';
import { User } from './models/user';
import { now, rand } from './utils';
export function newUser(user_seq: number, user_name: string): User {
return {
collection: 'user', user_seq, user_name, keycard_id: '', key_inquire_id: '',
// shows the first-play powder message; with the first stamp card this makes the 2 kira cards
// the wiki gives players without a key
powder_num: 1,
stamp_num: 0, stamp_conv_num: 0, stamp_bonus: 0, balance: 0, ticket_half_price: false,
ticket_rc_first: true, // the first rival card print guarantees a higher rarity (wiki)
equip: {}, material: {}, decoseal: {}, accessory: [], next_aseq: 1, cardbg: [],
release_state: 0, user_flags: [0, 0, 0, 0], last_time: 0, user_marker: 0,
mission_no: 1, // 0 would never start the missions
question_id: 0, sort_type: 0, disp_skill: 0, enemy: [], last_enemy: [], friendly: {}, gifts_used: [],
};
}
// Same as the game does locally: level 1, starting equips (grade 0), which also go into the closet.
export async function newDoll(u: User, doll_id: number, doll_name: string): Promise<Doll> {
const init = DOLL_INIT[doll_id] || [0, 0, 0, 0];
const doll: Doll = {
collection: 'doll', doll_seq: await nextSeq('doll'), user_seq: u.user_seq, doll_id, doll_name,
doll_seed: rand(23328), // growth type + 3 * five stat offsets in base 6; 23328 and up disables growth
doll_level: 1, equip: init.map(id => [id, 0]), accessory: [0, 0], makeup: [0, 0], luck_offset: 0,
};
for (const id of init) addCount(u.equip, id, 0, 1);
await DB.Insert(doll);
return doll;
}
// "New doll" on the entry menu stays disabled while release_state is 0 (label disable_lv5).
export async function updateRelease(u: User) {
const dolls = await DB.Find<Doll>({ collection: 'doll', user_seq: u.user_seq });
if (dolls.some(d => d.doll_level >= 5)) u.release_state = 1;
}
// guess: 1 = played again within a day, 2 = back after two weeks, 0 = otherwise
export function greeting(last: number) {
if (!last) return 0;
const days = (now() - last) / 86400;
return days < 1 ? 1 : days >= 14 ? 2 : 0;
}

9
otoca@asphyxia/utils.ts Normal file
View File

@@ -0,0 +1,9 @@
export const now = () => Math.floor(Date.now() / 1000);
export const rand = (n: number) => Math.floor(Math.random() * n);
export const u8 = (v: number) => K.ITEM('u8', v || 0);
export const u32 = (v: number) => K.ITEM('u32', v || 0);
export const bool = (v: boolean) => K.ITEM('bool', !!v);
export function log(method: string, data: any) {
console.log(`[otoca] ${method} ${JSON.stringify(data)}`);
}