Fix jubeat profile

This commit is contained in:
Kirito 2021-04-26 17:06:56 +09:00
parent 5797c2ca97
commit 8d0f882822
8 changed files with 359 additions and 228 deletions

View File

@ -1,20 +1,22 @@
import {getVersion} from "../utils";
export const shopinfo: EPR = (info, data, send) => {
const locId = $(data.shop).content("locationid");
const locId = $(data).content("shop.locationid");
const version = getVersion(info);
if (version === 0) return send.deny();
if (version === 3) return send.object({
data: {
cabid: K.ITEM('u32', 1),
locationid: K.ITEM('str', locId),
is_send: K.ITEM("u8", 1)
}
})
if (version === 3 || version === 4) {
return send.object({
data: {
cabid: K.ITEM('u32', 1),
locationid: K.ITEM('str', locId),
is_send: K.ITEM("u8", 1)
}
});
}
return send.deny();
}
};
export const demodata = {
getNews: (_, __, send) => send.object({ data: { officialnews: K.ATTR({ count: "0" }) } }),
@ -47,4 +49,4 @@ export const netlog: EPR = (info, data, send) => {
const errMsg = $(data).str('msg');
console.error(errMsg);
return send.success();
}
};

View File

@ -1,6 +1,11 @@
export const check: EPR = (info, data, send) => {
const enter = $(data).bool('data.enter');
const time = $(data).number('data.time');
// enter
// 0 - game is loading
// 1 - music select screen
return send.object({
data: {
entrant_nr: K.ITEM('u32', 1, { time: String(time) }),

View File

@ -16,10 +16,12 @@ export const profile: EPR = async (info, data, send) => {
if (!profile) {
if (!name) return send.deny();
const newProfile = new Profile();
newProfile.jubeatId = _.random(1, 99999999);
newProfile.name = name;
newProfile.previous_version = version;
const newProfile: Profile = {
collection: 'profile',
jubeatId: _.random(1, 99999999),
name: name,
previous_version: version
};
await DB.Upsert<Profile>(refId, { collection: "profile" }, newProfile);
@ -39,6 +41,63 @@ export const profile: EPR = async (info, data, send) => {
}
if (version === 3) {
if (!profile.knit) {
profile.knit = {
collabo: { completed: false, success: false },
info: {
acvPoint: 0,
acvProg: 0,
acvRouteProg: Array(4).fill(0),
acvWool: 0,
beatCount: 0,
conciergeSelectedCount: 0,
excellentCount: 0,
excellentSeqCount: 0,
fullcomboCount: 0,
fullcomboSeqCount: 0,
jubility: 0,
jubilityYday: 0,
matchCount: 0,
mynewsCount: 0,
saveCount: 0,
savedCount: 0,
tagCount: 0,
tuneCount: 0
},
item: {
markerList: Array(2).fill(0),
secretList: Array(2).fill(0),
themeList: 0,
titleList: Array(24).fill(0)
},
item_new: {
markerList: Array(2).fill(0),
secretList: Array(2).fill(0),
themeList: 0,
titleList: Array(24).fill(0)
},
last: {
areaname: 'NONE',
category: 0,
conciergeSuggestId: 0,
filter: 0,
marker: 0,
mselStat: 0,
musicId: 0,
parts: 0,
playTime: "0",
seqEditId: '',
seqId: 0,
shopname: 'NONE',
showCombo: 0,
showRank: 0,
sort: 0,
theme: 0,
title: 0
}
};
await DB.Update(refId, { collection: "profile" }, profile);
}
if (U.GetConfig("unlock_all_songs")) {
profile.knit.item = {
secretList: [-1, -1],
@ -53,14 +112,25 @@ export const profile: EPR = async (info, data, send) => {
titleList: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
};
}
return send.pugFile('templates/knit/profile.pug', { refId, migration, ...profile }, { compress: false });
return send.pugFile('templates/knit/profile.pug', {
refId,
migration,
name: profile.name,
jubeatId: profile.jubeatId, ...profile.knit
}, { compress: true });
}
if (version === 4) {
if (U.GetConfig("unlock_all_songs")) {
}
return send.pugFile('templates/copious/profile.pug', { refId, migration, ...profile }, { compress: false });
}
return send.deny();
};
export const saveProfile: EPR = async (info, { data }, send) => {
console.log(U.toXML(data));
const player = $(data).element("player");
const refId = player.str("refid");
@ -74,69 +144,67 @@ export const saveProfile: EPR = async (info, { data }, send) => {
if (version === 3) {
profile.name = player.str("name");
profile.last.shopname = player.str("shopname", profile.last.shopname);
profile.last.areaname = player.str("areaname", profile.last.areaname);
const { info, last, item, item_new, collabo } = profile.knit;
profile.jubility = player.number("info.jubility", profile.jubility);
profile.jubilityYday = player.number("info.jubility_yday", profile.jubilityYday);
last.shopname = player.str("shopname", last.shopname);
last.areaname = player.str("areaname", last.areaname);
profile.knit.acvProg = player.number("info.acv_prog", profile.knit.acvProg);
profile.knit.acvWool = player.number("info.acv_wool", profile.knit.acvWool);
profile.knit.acvRouteProg = player.numbers("info.acv_route_prog", profile.knit.acvRouteProg);
profile.knit.acvPoint = player.number("info.acv_point", profile.knit.acvPoint);
info.jubility = player.number("info.jubility", info.jubility);
info.jubilityYday = player.number("info.jubility_yday", info.jubilityYday);
info.acvProg = player.number("info.acv_prog", info.acvProg);
info.acvWool = player.number("info.acv_wool", info.acvWool);
info.acvRouteProg = player.numbers("info.acv_route_prog", info.acvRouteProg);
info.acvPoint = player.number("info.acv_point", info.acvPoint);
info.tuneCount = player.number("info.tune_cnt", info.tuneCount);
info.saveCount = player.number("info.save_cnt", info.saveCount);
info.savedCount = player.number("info.saved_cnt", info.savedCount);
info.fullcomboCount = player.number("info.fc_cnt", info.fullcomboCount);
info.fullcomboSeqCount = player.number("info.fc_seq_cnt", info.fullcomboSeqCount);
info.excellentCount = player.number("info.exc_cnt", info.excellentCount);
info.excellentSeqCount = player.number("info.exc_seq_cnt", info.excellentSeqCount);
info.matchCount = player.number("info.match_cnt", info.matchCount);
info.beatCount = player.number('info.beat_cnt', info.beatCount);
info.conciergeSelectedCount = player.number('info.con_sel_cnt', info.conciergeSelectedCount);
info.tagCount = player.number('info.tag_cnt', info.tagCount);
info.mynewsCount = player.number('info.mynews_cnt', info.mynewsCount);
profile.tuneCount = player.number("info.tune_cnt", profile.tuneCount);
profile.saveCount = player.number("info.save_cnt", profile.saveCount);
profile.savedCount = player.number("info.saved_cnt", profile.savedCount);
profile.fullcomboCount = player.number("info.fc_cnt", profile.fullcomboCount);
profile.fullcomboSeqCount = player.number("info.fc_seq_cnt", profile.fullcomboSeqCount);
profile.excellentCount = player.number("info.exc_cnt", profile.excellentCount);
profile.excellentSeqCount = player.number("info.exc_seq_cnt", profile.excellentSeqCount);
profile.matchCount = player.number("info.match_cnt", profile.matchCount);
profile.beatCount = player.number('info.beat_cnt', profile.beatCount);
profile.conciergeSelectedCount = player.number('info.con_sel_cnt', profile.conciergeSelectedCount);
profile.tagCount = player.number('info.tag_cnt', profile.tagCount);
profile.mynewsCount = player.number('info.mynews_cnt', profile.mynewsCount);
last.conciergeSuggestId = player.number('info.con_suggest_id', last.conciergeSuggestId);
last.playTime = String(new Date().getTime());
if (!U.GetConfig("unlock_all_songs")) {
profile.knit.item.secretList = player.numbers('item.secret_list', profile.knit.item.secretList);
profile.knit.item.themeList = player.number('item.theme_list', profile.knit.item.themeList);
profile.knit.item.markerList = player.numbers('item.marker_list', profile.knit.item.markerList);
profile.knit.item.titleList = player.numbers('item.title_list', profile.knit.item.titleList);
item.secretList = player.numbers('item.secret_list', item.secretList);
item.themeList = player.number('item.theme_list', item.themeList);
item.markerList = player.numbers('item.marker_list', item.markerList);
item.titleList = player.numbers('item.title_list', item.titleList);
profile.knit.item_new.secretList = player.numbers('item.secret_new', profile.knit.item_new.secretList);
profile.knit.item_new.themeList = player.number('item.theme_new', profile.knit.item_new.themeList);
profile.knit.item_new.markerList = player.numbers('item.marker_new', profile.knit.item_new.markerList);
profile.knit.item_new.titleList = player.numbers('item.title_new', profile.knit.item_new.titleList);
item_new.secretList = player.numbers('item.secret_new', profile.knit.item_new.secretList);
item_new.themeList = player.number('item.theme_new', profile.knit.item_new.themeList);
item_new.markerList = player.numbers('item.marker_new', profile.knit.item_new.markerList);
item_new.titleList = player.numbers('item.title_new', profile.knit.item_new.titleList);
}
profile.last.conciergeSuggestId = player.number('info.con_suggest_id', profile.last.conciergeSuggestId);
profile.last.playTime = BigInt(new Date().getMilliseconds());
// Append
const collabo = player.element("collabo");
if (collabo) {
profile.knit.collabo.success = collabo.bool("success");
profile.knit.collabo.completed = collabo.bool("completed");
const collaboNode = player.element("collabo");
if (collaboNode) {
collabo.success = collaboNode.bool("success");
collabo.completed = collaboNode.bool("completed");
}
const result = $(data).element("result");
if (result) {
const tunes = result.elements("tune");
for (const tune of tunes) {
const musicId = tune.number("music", 0);
profile.last.musicId = musicId;
profile.last.seqId = parseInt(tune.attr("player.score").seq) || 0;
profile.last.title = tune.number("title", profile.last.title);
profile.last.theme = tune.number("theme", profile.last.theme);
profile.last.marker = tune.number("marker", profile.last.marker);
profile.last.sort = tune.number("sort", profile.last.sort);
profile.last.filter = tune.number("filter", profile.last.filter);
profile.last.showRank = tune.number("combo_disp", profile.last.showRank);
profile.last.showCombo = tune.number("rank_sort", profile.last.showCombo);
profile.last.mselStat = tune.number("msel_stat", profile.last.mselStat);
last.musicId = musicId;
last.seqId = parseInt(tune.attr("player.score").seq) || 0;
last.title = tune.number("title", last.title);
last.theme = tune.number("theme", last.theme);
last.marker = tune.number("marker", last.marker);
last.sort = tune.number("sort", last.sort);
last.filter = tune.number("filter", last.filter);
last.showRank = tune.number("combo_disp", last.showRank);
last.showCombo = tune.number("rank_sort", last.showCombo);
last.mselStat = tune.number("msel_stat", last.mselStat);
const score = tune.number('player.score');
const seq = parseInt(tune.attr('player.score').seq);
@ -158,13 +226,15 @@ export const saveProfile: EPR = async (info, { data }, send) => {
});
}
}
}
try {
await DB.Update<Profile>(refId, { collection: "profile" }, profile);
return send.object({ data: { player: { session_id: K.ITEM('s32', 1) } } });
} catch {
return send.deny();
}
return send.deny();
};
export const loadScore: EPR = async (info, data, send) => {

View File

@ -8,6 +8,7 @@ export function register() {
return;
}
R.GameCode("J44");
R.GameCode("K44");
R.Config("unlock_all_songs", {
name: "Unlock All Songs",
@ -31,6 +32,8 @@ export function register() {
range: [15, 99],
});
R.Route("shopinfo.regist", shopinfo);
R.Route("gametop.regist", profile);
R.Route("gametop.get_pdata", profile);
R.Route("gametop.get_mdata", loadScore);
@ -51,6 +54,8 @@ export function register() {
R.Route("lobby.refresh", refresh);
R.Route("lobby.report", report);
R.Route("logger.report", true);
R.Unhandled((info, data, send) => {
console.log(info.module, info.method);
console.log(U.toXML(data));

View File

@ -1,101 +1,66 @@
export default class Profile {
collection: "profile" = "profile";
export default interface Profile {
collection: "profile";
jubeatId: number = _.random(1, 99999999);
name: string = "JUBEAT";
jubeatId: number;
name: string;
previous_version = 0;
previous_version: number;
jubility: number = 0;
jubilityYday: number = 0;
tuneCount: number = 0;
saveCount: number = 0;
savedCount: number = 0;
fullcomboCount: number = 0;
fullcomboSeqCount: number = 0;
excellentCount: number = 0;
excellentSeqCount: number = 0;
matchCount: number = 0;
beatCount: number = 0;
tagCount: number = 0;
mynewsCount: number = 0;
conciergeSelectedCount: number = 0;
last: {
shopname: string;
areaname: string;
playTime: bigint;
title: number;
theme: number;
marker: number;
showRank: number;
showCombo: number;
musicId: number;
seqId: number;
seqEditId: string;
sort: number;
filter: number;
mselStat: number;
conciergeSuggestId: number;
} = {
shopname: "NONE",
areaname: "NONE",
playTime: BigInt(0),
title: 0,
theme: 0,
marker: 0,
showRank: 1,
showCombo: 1,
musicId: 0,
seqId: 0,
seqEditId: "",
sort: 0,
filter: 0,
mselStat: 0,
conciergeSuggestId: 0
};
knit: {
acvProg: number;
acvWool: number;
acvRouteProg: number[];
acvPoint: number;
knit?: {
info: {
jubility: number;
jubilityYday: number;
acvProg: number;
acvWool: number;
acvRouteProg: number[];
acvPoint: number;
tuneCount: number;
saveCount: number;
savedCount: number;
fullcomboCount: number;
fullcomboSeqCount: number;
excellentCount: number;
excellentSeqCount: number;
matchCount: number;
beatCount: number;
tagCount: number;
mynewsCount: number;
conciergeSelectedCount: number;
};
last: {
shopname: string;
areaname: string;
playTime: string;
title: number;
parts: number;
theme: number;
marker: number;
showRank: number;
showCombo: number;
musicId: number;
seqId: number;
seqEditId: string;
sort: number;
filter: number;
category: number;
mselStat: number;
conciergeSuggestId: number;
};
item: {
secretList: number[],
themeList: number,
markerList: number[],
titleList: number[]
},
secretList: number[];
themeList: number;
markerList: number[];
titleList: number[];
};
item_new: {
secretList: number[],
themeList: number,
markerList: number[],
titleList: number[]
secretList: number[];
themeList: number;
markerList: number[];
titleList: number[];
},
collabo: {
success: boolean;
completed: boolean;
}
} = {
acvProg: 0,
acvWool: 0,
acvRouteProg: [0, 0, 0, 0],
acvPoint: 0,
item: {
secretList: [0, 0],
themeList: 0,
markerList: [0, 0],
titleList: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
item_new: {
secretList: [0, 0],
themeList: 0,
markerList: [0, 0],
titleList: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
collabo: {
success: false,
completed: false
}
};
}

View File

@ -0,0 +1,83 @@
gametop
data
player
name(__type="str") #{name}
jid(__type="s32") #{jubeatId}
session_id(__type="s32") 1
info
inherit(__type="bool") #{migration ? 1 : 0}
jubility(__type="s16") #{jubility}
jubility_yday(__type="s16") #{jubilityYday}
acv_point(__type="s32") 0
acv_state(__type="s8") 0
acv_throw(__type="s32") 0
acv_own(__type="s32") 0
tune_cnt(__type="s32") #{tuneCount}
save_cnt(__type="s32") #{saveCount}
saved_cnt(__type="s32") #{savedCount}
fc_cnt(__type="s32") #{fullcomboCount}
ex_cnt(__type="s32") #{excellentCount}
match_cnt(__type="s32") #{matchCount}
beat_cnt(__type="s32") #{beatCount}
mynews_cnt(__type="s32") #{mynewsCount}
mtg_entry_cnt(__type="s32") 0
mtg_hold_cnt(__type="s32") 0
mtg_result(__type="u8") 0
last
play_time(__type="s64") #{last.playTime || 0}
shopname(__type="str") #{last.shopname}
areaname(__type="str") #{last.areaname}
title(__type="s16") #{last.title}
parts(__type="s16") #{last.parts || 0}
theme(__type="s8") #{last.theme}
marker(__type="s8") #{last.marker}
rank_sort(__type="s8") #{last.showRank}
combo_disp(__type="s8") #{last.showCombo}
music_id(__type="s32") #{last.musicId}
seq_id(__type="s8") #{last.seqId}
sort(__type="s8") #{last.sort}
category(__type="s8") #{last.category || 0}
msel_stat(__type="s8") #{last.mselStat}
item
secret_list(__type="s32" __count="12") #{Array(1).fill(0)}
theme_list(__type="s16") 0
marker_list(__type="s32" __count="2") #{Array(1).fill(0)}
title_list(__type="s32" __count="32") #{Array(1).fill(0)}
parts_list(__type="s32" __count="32") #{Array(1).fill(0)}
new
secret_list(__type="s32" __count="12") #{Array(1).fill(0)}
theme_list(__type="s16") 0
marker_list(__type="s32" __count="2") #{Array(1).fill(0)}
title_list(__type="s32" __count="32") #{Array(1).fill(0)}
challenge
today
music_id(__type="s32") 0
onlynow
magic_no(__type="s32") 0
cycle(__type="s16") 0
group
music_id(__type="s32") 0
rate(__type="float") 1.0
reward
total(__type="s32") 0
point(__type="s32") 0
news
checked(__type="s16") 0
rivallist(count="0")
group
group_id(__type="s32") 0
bingo
music_id(__type="s32") 0
reward
total(__type="s32") 0
point(__type="s32") 0
history(count="0")

View File

@ -1,89 +1,89 @@
gametop
data
player
name(__type="str") #{name}
jid(__type="s32") #{jubeatId}
refid(__type="str") #{refId}
session_id(__type="s32") 1
data
player
name(__type="str") #{name}
jid(__type="s32") #{jubeatId}
refid(__type="str") #{refId}
session_id(__type="s32") 1
info
inherit(__type="bool") #{migration ? 1 : 0}
jubility(__type="s16") #{jubility}
jubility_yday(__type="s16") #{jubilityYday}
acv_prog(__type="s8") #{knit.acvProg}
acv_wool(__type="s8") #{knit.acvWool}
acv_route_prog(__type="s8" __count="4") #{knit.acvRouteProg.join(" ")}
acv_point(__type="s32") #{knit.acvPoint}
tune_cnt(__type="s32") #{tuneCount}
save_cnt(__type="s32") #{saveCount}
saved_cnt(__type="s32") #{savedCount}
fc_cnt(__type="s32") #{fullcomboCount}
ex_cnt(__type="s32") #{excellentCount}
match_cnt(__type="s32") #{matchCount}
beat_cnt(__type="s32") #{beatCount}
mynews_cnt(__type="s32") #{mynewsCount}
con_sel_cnt(__type="s32") #{conciergeSelectedCount}
tag_cnt(__type="s32") #{tagCount}
mtg_entry_cnt(__type="s32") 0
tag_entry_cnt(__type="s32") 0
mtg_hold_cnt(__type="s32") 0
tag_hold_cnt(__type="s32") 0
mtg_result(__type="u8") 0
info
inherit(__type="bool") #{migration ? 1 : 0}
jubility(__type="s16") #{info.jubility}
jubility_yday(__type="s16") #{info.jubilityYday}
acv_prog(__type="s8") #{info.acvProg}
acv_wool(__type="s8") #{info.acvWool}
acv_route_prog(__type="s8" __count="4") #{info.acvRouteProg.join(" ")}
acv_point(__type="s32") #{info.acvPoint}
tune_cnt(__type="s32") #{info.tuneCount}
save_cnt(__type="s32") #{info.saveCount}
saved_cnt(__type="s32") #{info.savedCount}
fc_cnt(__type="s32") #{info.fullcomboCount}
ex_cnt(__type="s32") #{info.excellentCount}
match_cnt(__type="s32") #{info.matchCount}
beat_cnt(__type="s32") #{info.beatCount}
mynews_cnt(__type="s32") #{info.mynewsCount}
con_sel_cnt(__type="s32") #{info.conciergeSelectedCount}
tag_cnt(__type="s32") #{info.tagCount}
mtg_entry_cnt(__type="s32") 0
tag_entry_cnt(__type="s32") 0
mtg_hold_cnt(__type="s32") 0
tag_hold_cnt(__type="s32") 0
mtg_result(__type="u8") 0
last
play_time(__type="s64") #{last.playTime || 0}
shopname(__type="str") #{last.shopname}
areaname(__type="str") #{last.areaname}
title(__type="s16") #{last.title}
theme(__type="s8") #{last.theme}
marker(__type="s8") #{last.marker}
rank_sort(__type="s8") #{last.showRank}
combo_disp(__type="s8") #{last.showCombo}
music_id(__type="s32") #{last.musicId}
seq_id(__type="s8") #{last.seqId}
sort(__type="s8") #{last.sort}
filter(__type="s32") #{last.filter}
msel_stat(__type="s8") #{last.mselStat}
con_suggest_id(__type="s8") #{last.conciergeSuggestId}
last
play_time(__type="s64") #{last.playTime}
shopname(__type="str") #{last.shopname}
areaname(__type="str") #{last.areaname}
title(__type="s16") #{last.title}
theme(__type="s8") #{last.theme}
marker(__type="s8") #{last.marker}
rank_sort(__type="s8") #{last.showRank}
combo_disp(__type="s8") #{last.showCombo}
music_id(__type="s32") #{last.musicId}
seq_id(__type="s8") #{last.seqId}
sort(__type="s8") #{last.sort}
filter(__type="s32") #{last.filter}
msel_stat(__type="s8") #{last.mselStat}
con_suggest_id(__type="s8") #{last.conciergeSuggestId}
item
secret_list(__type="s32" __count="2") #{knit.item.secretList.join(" ")}
theme_list(__type="s16") #{knit.item.themeList}
marker_list(__type="s32" __count="2") #{knit.item.markerList.join(" ")}
title_list(__type="s32" __count="24") #{knit.item.titleList.join(" ")}
item
secret_list(__type="s32" __count="2") #{item.secretList.join(" ")}
theme_list(__type="s16") #{item.themeList}
marker_list(__type="s32" __count="2") #{item.markerList.join(" ")}
title_list(__type="s32" __count="24") #{item.titleList.join(" ")}
new
secret_list(__type="s32" __count="2") #{knit.item_new.secretList.join(" ")}
theme_list(__type="s16") #{knit.item_new.themeList}
marker_list(__type="s32" __count="2") #{knit.item_new.markerList.join(" ")}
title_list(__type="s32" __count="24") #{knit.item_new.titleList.join(" ")}
new
secret_list(__type="s32" __count="2") #{item_new.secretList.join(" ")}
theme_list(__type="s16") #{item_new.themeList}
marker_list(__type="s32" __count="2") #{item_new.markerList.join(" ")}
title_list(__type="s32" __count="24") #{item_new.titleList.join(" ")}
today_music
music_id(__type="s32") 0
today_music
music_id(__type="s32") 0
news
checked(__type="s16") 0
news
checked(__type="s16") 0
friendlist(count="0")
friendlist(count="0")
lucky_music
music_id(__type="s32") 0
lucky_music
music_id(__type="s32") 0
mylist(count="0")
mylist(count="0")
group
group_id(__type="s32") 0
group
group_id(__type="s32") 0
bingo
reward
total(__type="s32") 0
point(__type="s32") 0
bingo
reward
total(__type="s32") 0
point(__type="s32") 0
collabo
success(__type="bool") #{knit.collabo.success ? 1 : 0}
completed(__type="bool") #{knit.collabo.completed ? 1 : 0}
collabo
success(__type="bool") #{collabo.success ? 1 : 0}
completed(__type="bool") #{collabo.completed ? 1 : 0}
history
play_hist(count="0")
history
play_hist(count="0")
match_hist(count="0")
match_hist(count="0")

View File

@ -2,5 +2,6 @@ export function getVersion({ model }: EamuseInfo) {
const dateCode = model.split(':')[4];
if (model.startsWith("J44")) return 3;
if (model.startsWith("K44")) return 4;
return 0;
}