mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-03-22 01:44:39 -05:00
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
import { gameInfoGet, shopInfoRegist } from "./handlers/info";
|
|
import { playableMusic } from "./handlers/MusicList"
|
|
import { getPlayer, check, regist, savePlayer } from "./handlers/profiles";
|
|
import { updatePlayerInfo } from "./handlers/webui";
|
|
import { isAsphyxiaDebugMode, isRequiredCoreVersion } from "./utils";
|
|
import Logger from "./utils/logger";
|
|
|
|
const logger = new Logger("main")
|
|
|
|
export function register() {
|
|
if(!isRequiredCoreVersion(1, 20)) {
|
|
console.error("You need newer version of Core. v1.20 or newer required.")
|
|
}
|
|
|
|
R.GameCode('M32');
|
|
|
|
R.Config("encore_version", {
|
|
name: "Encore Version",
|
|
desc: "Set encore version",
|
|
type: "integer",
|
|
default: 13,
|
|
})
|
|
|
|
R.Config("nextage_dummy_encore", {
|
|
name: "Dummy Encore for SPE (Nextage Only)",
|
|
desc: "Since Nextage's Special Premium Encore system is bit complicated, \n"
|
|
+ "SPE System isn't fully implemented. \n"
|
|
+ "This thing is bandage of these problem as limiting some Encores for SPE.",
|
|
type: "boolean",
|
|
default: false
|
|
})
|
|
|
|
R.Config("enable_custom_mdb", {
|
|
name: "Enable Custom MDB",
|
|
desc: "For who uses own MDB. eg) Omnimix.",
|
|
type: "boolean",
|
|
default: false,
|
|
})
|
|
|
|
R.DataFile("data/mdb/custom.xml", {
|
|
accept: ".xml",
|
|
name: "Custom MDB",
|
|
desc: "You need to enable Custom MDB option first."
|
|
})
|
|
|
|
R.WebUIEvent('updatePlayerInfo', updatePlayerInfo);
|
|
|
|
const MultiRoute = (method: string, handler: EPR | boolean) => {
|
|
// Helper for register multiple versions.
|
|
R.Route(`exchain_${method}`, handler);
|
|
R.Route(`matixx_${method}`, handler);
|
|
R.Route(`nextage_${method}`, handler)
|
|
// TODO: TB, TBRE and more older version?
|
|
};
|
|
|
|
// Info
|
|
MultiRoute('shopinfo.regist', shopInfoRegist)
|
|
MultiRoute('gameinfo.get', gameInfoGet)
|
|
|
|
// MusicList
|
|
MultiRoute('playablemusic.get', playableMusic)
|
|
|
|
// Profile
|
|
MultiRoute('cardutil.regist', regist);
|
|
MultiRoute('cardutil.check', check);
|
|
MultiRoute('gametop.get', getPlayer);
|
|
MultiRoute('gameend.regist', savePlayer);
|
|
|
|
// Misc
|
|
R.Route('bemani_gakuen.get_music_info', true)
|
|
|
|
R.Unhandled(async (info, data, send) => {
|
|
if (["eventlog"].includes(info.module)) return;
|
|
logger.error(`Received Unhandled Request on Method "${info.method}" by ${info.model}/${info.module}`)
|
|
logger.debugError(`Received Request: ${JSON.stringify(data, null, 4)}`)
|
|
})
|
|
} |