Merge pull request #28 from DitFranXX/gitadora-somethingnew

Gitadora v1.1.1
This commit is contained in:
Freddie Wang
2021-05-28 10:54:10 +08:00
committed by GitHub
5 changed files with 88 additions and 22 deletions
+8 -2
View File
@@ -1,6 +1,6 @@
GITADORA Plugin for Asphyxia-Core GITADORA Plugin for Asphyxia-Core
================================= =================================
![Version: v1.1.0](https://img.shields.io/badge/version-v1.1.0-blue) ![Version: v1.1.1](https://img.shields.io/badge/version-v1.1.1-blue)
This plugin is based on converted from public-exported Asphyxia's Routes. This plugin is based on converted from public-exported Asphyxia's Routes.
@@ -29,8 +29,14 @@ Known Issues
Release Notes 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.) * NEX+AGE Support (Not full support.)
* Restructure bit for maintaining. * Restructure bit for maintaining.
+5 -2
View File
@@ -1,6 +1,9 @@
import { getVersion } from "../utils"; import { getVersion } from "../utils";
import { defaultProcessRawData, processDataBuilder } from "../data/mdb" import { defaultProcessRawData, processDataBuilder } from "../data/mdb"
import { CommonMusicDataField, readJSONOrXML, readXML } 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) => { export const playableMusic: EPR = async (info, data, send) => {
const version = getVersion(info); const version = getVersion(info);
@@ -10,8 +13,8 @@ export const playableMusic: EPR = async (info, data, send) => {
music = (await defaultProcessRawData('data/mdb/custom.xml')).music music = (await defaultProcessRawData('data/mdb/custom.xml')).music
} }
} catch (e) { } catch (e) {
console.error(e.stack); logger.warn("Read Custom MDB failed. Using default MDB as a fallback.")
console.error("Fallback: Using default MDB method.") logger.debugWarn(e.stack);
music = []; music = [];
} }
+5 -14
View File
@@ -391,20 +391,11 @@ export const getPlayer: EPR = async (info, data, send) => {
player: K.ATTR({ 'no': `${no}` }, { player: K.ATTR({ 'no': `${no}` }, {
now_date: K.ITEM('u64', time), now_date: K.ITEM('u64', time),
secretmusic: { // TODO: FIX THIS secretmusic: { // TODO: FIX THIS
music: _.merge(_.range(0,2800), _.range(5000, 5100)).map(mid => { music: {
return { musicid: K.ITEM('s32', 0),
musicid: K.ITEM('s32', mid), seq: K.ITEM('u16', 255),
seq: K.ITEM('u16', 255), kind: K.ITEM('s32', 40),
kind: K.ITEM('s32', 40), }
}
}),
},
trbitem: { // TODO: FIX THIS
item: _.range(0,750).map(id => {
return {
itemid: K.ITEM('s32', id),
}
}),
}, },
chara_list: {}, chara_list: {},
title_parts: {}, title_parts: {},
+8 -4
View File
@@ -3,6 +3,9 @@ import { playableMusic } from "./handlers/MusicList"
import { getPlayer, check, regist, savePlayer } from "./handlers/profiles"; import { getPlayer, check, regist, savePlayer } from "./handlers/profiles";
import { updatePlayerInfo } from "./handlers/webui"; import { updatePlayerInfo } from "./handlers/webui";
import { isAsphyxiaDebugMode, isRequiredCoreVersion } from "./utils"; import { isAsphyxiaDebugMode, isRequiredCoreVersion } from "./utils";
import Logger from "./utils/logger";
const logger = new Logger("main")
export function register() { export function register() {
if(!isRequiredCoreVersion(1, 20)) { if(!isRequiredCoreVersion(1, 20)) {
@@ -63,11 +66,12 @@ export function register() {
MultiRoute('gametop.get', getPlayer); MultiRoute('gametop.get', getPlayer);
MultiRoute('gameend.regist', savePlayer); MultiRoute('gameend.regist', savePlayer);
// Misc
R.Route('bemani_gakuen.get_music_info', true)
R.Unhandled(async (info, data, send) => { R.Unhandled(async (info, data, send) => {
if (["eventlog"].includes(info.module)) return; if (["eventlog"].includes(info.module)) return;
console.error(`Received Unhandled Response on ${info.method} by ${info.model}/${info.module}`) logger.error(`Received Unhandled Request on Method "${info.method}" by ${info.model}/${info.module}`)
if (isAsphyxiaDebugMode()){ logger.debugError(`Received Request: ${JSON.stringify(data, null, 4)}`)
console.error(`Received Request: ${JSON.stringify(data, null, 4)}`)
}
}) })
} }
+62
View 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)
}
}
}