mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-03-21 17:34:46 -05:00
Use newer API for custom MDB. Fix Grafica issue.
This commit is contained in:
parent
3d3247a98b
commit
a8f5b3f082
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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<Profile>(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")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user