Skip to content

Commit

Permalink
fix: speaker error with hatsuki
Browse files Browse the repository at this point in the history
  • Loading branch information
biuuu committed Jul 12, 2022
1 parent 0e273b3 commit cb717b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shinycolors-zh",
"version": "1.9.3",
"version": "1.9.4",
"main": "main.js",
"repository": "[email protected]:biuuu/ShinyColors.git",
"author": "biuuu",
Expand Down
17 changes: 16 additions & 1 deletion src/modules/story/speaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,25 @@ const ensureName = async () => {
return await namePromise
}

let idolFlag = false
let staffFlag = false
const checkSpeakerData = (data, type) => {
if (idolFlag && staffFlag) {
return false
}
if (type === 'idol' && data[0]?.['002']?.includes && data[0]?.['002']?.includes('灯織')) {
idolFlag = true
return data[0]?.['002']?.includes('灯織')
} else if (data[0]?.[901]?.includes && data[0]?.[901]?.includes('はづき')) {
staffFlag = true
return data[0]?.[901]?.includes('はづき')
}
}

const originObjKeys = Object.keys
Object.keys = new Proxy(originObjKeys, {
apply (target, self, args) {
if (args[0]?.['002']?.includes('灯織') || args[0]?.[901]?.includes('はづき')) {
if (checkSpeakerData(args, 'idol') || checkSpeakerData(args, 'staff')) {
for (let [id, name] of iconMap) {
let _name = tagText(name)
if (Array.isArray(args[0][id]) && !args[0][id].includes(_name)) {
Expand Down

0 comments on commit cb717b6

Please sign in to comment.