diff --git a/assets/json/hearing-test.json b/assets/json/hearing-test.json index 72ecc237..82e9dc62 100644 --- a/assets/json/hearing-test.json +++ b/assets/json/hearing-test.json @@ -1,50 +1,47 @@ [ { "age": "all", + "khz": 8, "file": "8000.mp3" }, { "age": "60", + "khz": 10, "file": "10000.mp3" }, { "age": "50", + "khz": 12, "file": "12000.mp3" }, { "age": "45", + "khz": 14, "file": "14000.mp3" }, { - "age": "39", + "age": "40", + "khz": 15, "file": "15000.mp3" }, { "age": "30", + "khz": 16, "file": "16000.mp3" }, { - "age": "24", + "age": "20", + "khz": 17, "file": "17000.mp3" }, { - "age": "24", - "file": "18000.mp3" - }, - { - "age": "24", - "file": "19000.mp3" - }, - { - "age": "24", + "age": "8", + "khz": 20, "file": "20000.mp3" }, { - "age": "20", - "file": "21000.mp3" - }, - { - "age": "18", + "age": "max", + "khz": 22, "file": "22000.mp3" } ] diff --git a/assets/sounds/hearing-test/18000.mp3 b/assets/sounds/hearing-test/18000.mp3 deleted file mode 100644 index ea681d7a..00000000 Binary files a/assets/sounds/hearing-test/18000.mp3 and /dev/null differ diff --git a/assets/sounds/hearing-test/19000.mp3 b/assets/sounds/hearing-test/19000.mp3 deleted file mode 100644 index 4eaf763a..00000000 Binary files a/assets/sounds/hearing-test/19000.mp3 and /dev/null differ diff --git a/assets/sounds/hearing-test/21000.mp3 b/assets/sounds/hearing-test/21000.mp3 deleted file mode 100644 index 8b24d323..00000000 Binary files a/assets/sounds/hearing-test/21000.mp3 and /dev/null differ diff --git a/commands/games-sp/hearing-test.js b/commands/games-sp/hearing-test.js index af6cc515..857df0a9 100644 --- a/commands/games-sp/hearing-test.js +++ b/commands/games-sp/hearing-test.js @@ -1,5 +1,6 @@ const Command = require('../../structures/Command'); const path = require('path'); +const { stripIndents } = require('common-tags'); const { delay, verify } = require('../../util/Util'); const data = require('../../assets/json/hearing-test'); @@ -36,18 +37,33 @@ module.exports = class HearingTestCommand extends Command { } try { let age; - for (const { age: dataAge, file } of data) { + let range; + let previousAge = 'all'; + let previousRange = 8; + for (const { age: dataAge, khz, file } of data) { connection.play(path.join(__dirname, '..', '..', 'assets', 'sounds', 'hearing-test', file)); await delay(3500); await msg.reply('Did you hear that sound? Reply with **[y]es** or **[n]o**.'); const heard = await verify(msg.channel, msg.author); if (!heard || file === data[data.length - 1].file) { - age = dataAge; + age = previousAge; + range = previousRange; break; } + previousAge = dataAge; + previousRange = khz; } if (age === 'all') return msg.reply('Everyone should be able to hear that. You cannot hear.'); - return msg.reply(`You have the hearing of someone **${Number.parseInt(age, 10) + 1} or older**.`); + if (age === 'max') { + return msg.reply(stripIndents` + You can hear any frequency of which a human is capable. + The maximum frequency you were able to hear was **${range}000hz**. + `); + } + return msg.reply(stripIndents` + You have the hearing of someone **${Number.parseInt(age, 10) + 1} or older**. + The maximum frequency you were able to hear was **${range}000hz**. + `); } catch (err) { return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); } diff --git a/package.json b/package.json index 2118690b..52d435b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "123.0.3", + "version": "123.0.4", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {