mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-03-21 17:34:46 -05:00
Merge pull request #28 from DitFranXX/gitadora-somethingnew
Gitadora v1.1.1
This commit is contained in:
commit
7f8e3989ea
|
|
@ -1,6 +1,6 @@
|
|||
GITADORA Plugin for Asphyxia-Core
|
||||
=================================
|
||||

|
||||

|
||||
|
||||
This plugin is based on converted from public-exported Asphyxia's Routes.
|
||||
|
||||
|
|
@ -29,8 +29,14 @@ Known Issues
|
|||
|
||||
Release Notes
|
||||
=============
|
||||
v1.1.0 (Current)
|
||||
v1.1.1 (Current)
|
||||
----------------
|
||||
* fix: Error when create new profile on exchain.
|
||||
* fix: last song doesn't work correctly.
|
||||
* misc: Add logger for tracking problem.
|
||||
|
||||
v1.1.0
|
||||
------
|
||||
* NEX+AGE Support (Not full support.)
|
||||
* Restructure bit for maintaining.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import { getVersion } from "../utils";
|
||||
import { defaultProcessRawData, processDataBuilder } from "../data/mdb"
|
||||
import { CommonMusicDataField, readJSONOrXML, readXML } from "../data/mdb";
|
||||
import Logger from "../utils/logger"
|
||||
|
||||
const logger = new Logger("MusicList")
|
||||
|
||||
export const playableMusic: EPR = async (info, data, send) => {
|
||||
const version = getVersion(info);
|
||||
|
|
@ -10,8 +13,8 @@ export const playableMusic: EPR = async (info, data, send) => {
|
|||
music = (await defaultProcessRawData('data/mdb/custom.xml')).music
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e.stack);
|
||||
console.error("Fallback: Using default MDB method.")
|
||||
logger.warn("Read Custom MDB failed. Using default MDB as a fallback.")
|
||||
logger.debugWarn(e.stack);
|
||||
music = [];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -391,20 +391,11 @@ export const getPlayer: EPR = async (info, data, send) => {
|
|||
player: K.ATTR({ 'no': `${no}` }, {
|
||||
now_date: K.ITEM('u64', time),
|
||||
secretmusic: { // TODO: FIX THIS
|
||||
music: _.merge(_.range(0,2800), _.range(5000, 5100)).map(mid => {
|
||||
return {
|
||||
musicid: K.ITEM('s32', mid),
|
||||
seq: K.ITEM('u16', 255),
|
||||
kind: K.ITEM('s32', 40),
|
||||
}
|
||||
}),
|
||||
},
|
||||
trbitem: { // TODO: FIX THIS
|
||||
item: _.range(0,750).map(id => {
|
||||
return {
|
||||
itemid: K.ITEM('s32', id),
|
||||
}
|
||||
}),
|
||||
music: {
|
||||
musicid: K.ITEM('s32', 0),
|
||||
seq: K.ITEM('u16', 255),
|
||||
kind: K.ITEM('s32', 40),
|
||||
}
|
||||
},
|
||||
chara_list: {},
|
||||
title_parts: {},
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ 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)) {
|
||||
|
|
@ -63,11 +66,12 @@ export function register() {
|
|||
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;
|
||||
console.error(`Received Unhandled Response on ${info.method} by ${info.model}/${info.module}`)
|
||||
if (isAsphyxiaDebugMode()){
|
||||
console.error(`Received Request: ${JSON.stringify(data, null, 4)}`)
|
||||
}
|
||||
logger.error(`Received Unhandled Request on Method "${info.method}" by ${info.model}/${info.module}`)
|
||||
logger.debugError(`Received Request: ${JSON.stringify(data, null, 4)}`)
|
||||
})
|
||||
}
|
||||
62
gitadora@asphyxia/utils/logger.ts
Normal file
62
gitadora@asphyxia/utils/logger.ts
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import { isAsphyxiaDebugMode } from ".";
|
||||
|
||||
export default class Logger {
|
||||
public category: string | null;
|
||||
|
||||
public constructor(category?: string) {
|
||||
this.category = (category == null) ? null : `[${category}]`
|
||||
}
|
||||
|
||||
|
||||
public error(...args: any[]) {
|
||||
this.argsHandler(console.error, ...args)
|
||||
}
|
||||
|
||||
public debugError(...args: any[]) {
|
||||
if (isAsphyxiaDebugMode()) {
|
||||
this.argsHandler(console.error, ...args)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public warn(...args: any[]) {
|
||||
this.argsHandler(console.warn, ...args)
|
||||
}
|
||||
|
||||
public debugWarn(...args: any[]) {
|
||||
if (isAsphyxiaDebugMode()) {
|
||||
this.argsHandler(console.warn, ...args)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public info(...args: any[]) {
|
||||
this.argsHandler(console.info, ...args)
|
||||
}
|
||||
|
||||
public debugInfo(...args: any[]) {
|
||||
if (isAsphyxiaDebugMode()) {
|
||||
this.argsHandler(console.info, ...args)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public log(...args: any[]) {
|
||||
this.argsHandler(console.log, ...args)
|
||||
}
|
||||
|
||||
public debugLog(...args: any[]) {
|
||||
if (isAsphyxiaDebugMode()) {
|
||||
this.argsHandler(console.log, ...args)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private argsHandler(target: Function, ...args: any[]) {
|
||||
if (this.category == null) {
|
||||
target(...args)
|
||||
} else {
|
||||
target(this.category, ...args)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user