Skip to content

Commit

Permalink
测试版,Mod支持execute属性
Browse files Browse the repository at this point in the history
  • Loading branch information
iamapig120 committed Jan 19, 2019
1 parent e2c1b19 commit 805095c
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 3 deletions.
6 changes: 6 additions & 0 deletions manager/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ const saveSettings = () => {
modLaunched = modLaunched.filter(element => {
return modsWindowList.includes(`${element.name}|${element.author}`)
})
modLaunched.forEach(modInfo=>{
if(modInfo.execute){
modInfo.execute.filesDir = modInfo.filesDir
executeLaunched.push(modInfo.execute)
}
})

fs.writeFileSync(executeSettingsFile, JSON.stringify(executeLaunched), {
encoding: 'utf-8'
Expand Down
7 changes: 6 additions & 1 deletion mod/active.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"name": "千织普通改绿头鸭",
"author": "Handle",
"description": "图片来源pixabay,由Capri23auto上传,CC0协议\n这是一个Mod示范,用途为将普通千织立绘和头像改为绿头鸭。"
"description": "图片来源pixabay,由Capri23auto上传,CC0协议\n这是一个Mod示范,用途为将普通千织立绘和头像改为绿头鸭。",
"replace": [],
"execute": {
"name": "千织普通改绿头鸭台词插件",
"entry": "script.js"
}
}
]
Binary file added mod/mallard/files/0/audio/sound/mallard/quack.mp3
Binary file not shown.
6 changes: 5 additions & 1 deletion mod/mallard/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
"name": "千织普通改绿头鸭",
"author": "Handle",
"description": "图片来源pixabay,由Capri23auto上传,CC0协议\n这是一个Mod示范,用途为将普通千织立绘和头像改为绿头鸭。",
"replace": []
"replace": [],
"execute": {
"name": "千织普通改绿头鸭台词插件",
"entry": "script.js"
}
}
53 changes: 53 additions & 0 deletions mod/mallard/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// 修改千织语音台词
console.log('已Hack语音')
const funcBackup = cfg.voice.sound.getGroup
cfg.voice.sound.getGroup = function(soundID) {
const soundGroup = funcBackup.call(this, soundID)
if (soundID === 4) {
const changeMap = {
大厅交互语音1: {
words: '呱!',
path: 'audio/sound/mallard/quack'
},
大厅交互语音2: {
words: '呱!',
path: 'audio/sound/mallard/quack'
},
大厅交互语音3: {
words: '呱!',
path: 'audio/sound/mallard/quack'
},
大厅交互语音4: {
words: '呱!',
path: 'audio/sound/mallard/quack'
},
大厅交互语音5: {
words: '呱!',
path: 'audio/sound/mallard/quack'
},
大厅交互语音6: {
words: '呱!',
path: 'audio/sound/mallard/quack'
},
大厅交互语音7: {
words: '呱!',
path: 'audio/sound/mallard/quack'
},
大厅交互语音8: {
words: '呱!',
path: 'audio/sound/mallard/quack'
}
}
const keyArray = Object.keys(changeMap)
Object.entries(soundGroup).forEach(([soundKey, soundObject]) => {
// soundObject.level_limit = 0
if (keyArray.includes(soundObject.name)) {
soundGroup[soundKey] = {
...soundObject,
...changeMap.soundObject.name
}
}
})
}
return soundGroup
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "majsoul-plus-client",
"version": "1.6.2-alpha.2",
"version": "1.6.2-alpha.3",
"productName": "Majsoul Plus",
"author": "MajsoulPlus Team",
"description": "Majsoul Plus",
Expand Down

0 comments on commit 805095c

Please sign in to comment.