mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-09-22 22:27:56 +03:00
fix mattix and use less dupe codes
This commit is contained in:
@@ -100,7 +100,7 @@ export async function defaultProcessRawData(path: string): Promise<CommonMusicDa
|
|||||||
cont_dm: K.ITEM('bool', dm == 0 ? 0 : 1),
|
cont_dm: K.ITEM('bool', dm == 0 ? 0 : 1),
|
||||||
is_secret: K.ITEM('bool', 0),
|
is_secret: K.ITEM('bool', 0),
|
||||||
is_hot: K.ITEM('bool', type == 2 ? 0 : 1),
|
is_hot: K.ITEM('bool', type == 2 ? 0 : 1),
|
||||||
data_ver: K.ITEM('s32', m.number("data_ver")),
|
data_ver: K.ITEM('s32', m.number("data_ver", 115)),
|
||||||
diff: K.ARRAY('u16', [
|
diff: K.ARRAY('u16', [
|
||||||
d[0],
|
d[0],
|
||||||
d[1],
|
d[1],
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
import { getVersion } from "../utils";
|
import { getVersion } from "../utils";
|
||||||
import { processDataBuilder } from "../data"
|
import { defaultProcessRawData, processDataBuilder } from "../data"
|
||||||
import { CommonMusicDataField, readJSONOrXML, readXML } from "../data";
|
import { CommonMusicDataField, readJSONOrXML, readXML } from "../data";
|
||||||
|
|
||||||
export const playableMusic: EPR = async (info, data, send) => {
|
export const playableMusic: EPR = async (info, data, send) => {
|
||||||
@@ -7,50 +7,7 @@ export const playableMusic: EPR = async (info, data, send) => {
|
|||||||
let music: CommonMusicDataField[] = [];
|
let music: CommonMusicDataField[] = [];
|
||||||
try {
|
try {
|
||||||
if (U.GetConfig("enable_custom_mdb")) {
|
if (U.GetConfig("enable_custom_mdb")) {
|
||||||
const data = await readXML('data/custom_mdb.xml')
|
music = (await defaultProcessRawData('data/custom_mdb.xml')).music
|
||||||
const mdb = $(data).elements("mdb.mdb_data");
|
|
||||||
|
|
||||||
for (const m of mdb) {
|
|
||||||
const d = m.numbers("xg_diff_list");
|
|
||||||
const contain = m.numbers("contain_stat");
|
|
||||||
const gf = contain[0];
|
|
||||||
const dm = contain[1];
|
|
||||||
|
|
||||||
if (gf == 0 && dm == 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let type = gf;
|
|
||||||
if (gf == 0) {
|
|
||||||
type = dm;
|
|
||||||
}
|
|
||||||
|
|
||||||
music.push({
|
|
||||||
id: K.ITEM('s32', m.number("music_id")),
|
|
||||||
cont_gf: K.ITEM('bool', gf == 0 ? 0 : 1),
|
|
||||||
cont_dm: K.ITEM('bool', dm == 0 ? 0 : 1),
|
|
||||||
is_secret: K.ITEM('bool', 0),
|
|
||||||
is_hot: K.ITEM('bool', type == 2 ? 0 : 1),
|
|
||||||
data_ver: K.ITEM('s32', m.number("data_ver", 115)),
|
|
||||||
diff: K.ARRAY('u16', [
|
|
||||||
d[0],
|
|
||||||
d[1],
|
|
||||||
d[2],
|
|
||||||
d[3],
|
|
||||||
d[4],
|
|
||||||
d[10],
|
|
||||||
d[11],
|
|
||||||
d[12],
|
|
||||||
d[13],
|
|
||||||
d[14],
|
|
||||||
d[5],
|
|
||||||
d[6],
|
|
||||||
d[7],
|
|
||||||
d[8],
|
|
||||||
d[9],
|
|
||||||
]),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e.stack);
|
console.error(e.stack);
|
||||||
|
|||||||
Reference in New Issue
Block a user