diff --git a/museca@asphyxia/handlers/common.ts b/museca@asphyxia/handlers/common.ts index 81d1d3d..3442955 100644 --- a/museca@asphyxia/handlers/common.ts +++ b/museca@asphyxia/handlers/common.ts @@ -13,7 +13,7 @@ export const shop: EPR = async (info, data, send) => { export const common: EPR = async (info, data, send) => { let { music } = U.GetConfig("enable_custom_mdb") - ? await processMdbData(path.normalize(U.GetConfig("custom_mdb_path"))) + ? await processCustomData() : (await processValidData(info)) if (music.length === 0) { @@ -70,11 +70,15 @@ export const exception: EPR = async (info, data, send) => { send.success() } +async function processCustomData() { + return processMdbData("data/custom_mdb.xml") +} + async function processValidData(info: EamuseInfo) { const version = parseInt(info.model.trim().substr(10), 10) if (version >= 2020102200) { // MUSECA PLUS - return await processCommunityPlusData(); + processCommunityPlusData(); } else /** if (version > 2016071300) */ { return await processOnePlusHalfData() } /** else { diff --git a/museca@asphyxia/handlers/player.ts b/museca@asphyxia/handlers/player.ts index dcee88c..7fb691a 100644 --- a/museca@asphyxia/handlers/player.ts +++ b/museca@asphyxia/handlers/player.ts @@ -15,9 +15,10 @@ export const load: EPR = async (info, data, send) => { } const item = _.map(profile.item, (v, k) => { + const id = k.replace("g", "") return { type: K.ITEM("u8", v.type), - id: K.ITEM("u32", parseInt(k)), + id: K.ITEM("u32", parseInt(id)), param: K.ITEM("u32", v.param) } }) @@ -98,8 +99,11 @@ export const save: EPR = async (info, data, send) => { const dbItem = (await DB.FindOne(refid, { collection: "profile" })).item for(const item of $(data).elements("item.info")) { - dbItem[item.number("id")] = { - type: item.number("type"), + const id = item.number("id"); + const type = item.number("type") + // Grafica and Mission shares same ID. Why????? + dbItem[type == 16 ? `g${id}` : id] = { + type, param : item.number("param") } } diff --git a/museca@asphyxia/index.ts b/museca@asphyxia/index.ts index 5ff3076..e5838f4 100644 --- a/museca@asphyxia/index.ts +++ b/museca@asphyxia/index.ts @@ -2,6 +2,10 @@ import { common, exception, lounge, shop, hiscore, frozen } from "./handlers/com import { load, load_m, newProfile, save, save_m } from "./handlers/player"; export function register() { + if(!R.DataFile) { // TODO: Better implementation. + return console.error("You need newer version of Core.") + } + R.GameCode('PIX'); R.Config("unlock_all_songs", { @@ -17,11 +21,10 @@ export function register() { default: false, }) - R.Config("custom_mdb_path", { - name: "Custom MDB PATH", - desc: "You need to enable Custom MDB option first. USE ABSOLUTE PATH !!", - type: "string", - default: "", + R.DataFile("data/custom_mdb.xml", { + accept: ".xml", + name: "Custom MDB", + desc: "You need to enable Custom MDB option first." }) const Route = (method: string, handler: EPR | boolean) => { @@ -43,6 +46,7 @@ export function register() { Route("new", newProfile) Route("save", save) Route("save_m", save_m) + //Route("save_c", save_c) Route("load", load) Route("load_m", load_m)