Skip to content

Commit

Permalink
Issue#83 - Option for disabling sounds effect
Browse files Browse the repository at this point in the history
  • Loading branch information
Jengines committed Jan 5, 2019
1 parent 129a6c2 commit 9f94c32
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 7 deletions.
17 changes: 12 additions & 5 deletions js/components/macros.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@
return buffs;
}

function soundEffect(num) {
return '<se.' + num + '>';
/**
* Function used to display sound effect on macro
*
* @param num number of sound to use
* @param sound {boolean} true if sound is enabled, false else
* @returns {string}
*/
function soundEffect(num, sound) {
return sound ? '<se.' + num + '>' : '';
}

function extractCrossClassActions(options, sequence, cls) {
Expand Down Expand Up @@ -95,7 +102,7 @@
}

if (lines.length > 0) {
lines.push('/echo Cross-class action setup complete ' + soundEffect(options.stepSoundEffect) + '\n');
lines.push('/echo Cross-class action setup complete ' + soundEffect(options.stepSoundEffect, options.stepSoundEnabled) + '\n');
}

return lines;
Expand Down Expand Up @@ -153,7 +160,7 @@

if (macroLineCount === MAX_LINES - 1) {
if (lines.length - (j + 1) > 1) {
macroString += '/echo Macro #' + macroIndex + ' complete ' + soundEffect(options.stepSoundEffect) + '\n';
macroString += '/echo Macro #' + macroIndex + ' complete ' + soundEffect(options.stepSoundEffect, options.stepSoundEnabled) + '\n';
macroList.push({text: macroString, time: macroTime});

macroString = '';
Expand All @@ -171,7 +178,7 @@

if (macroLineCount > 0) {
if (macroLineCount < MAX_LINES) {
macroString += '/echo Macro #' + macroIndex + ' complete ' + soundEffect(options.finishSoundEffect) + '\n';
macroString += '/echo Macro #' + macroIndex + ' complete ' + soundEffect(options.finishSoundEffect, options.stepSoundEnabled) + '\n';
}
macroList.push({text: macroString, time: macroTime});
}
Expand Down
1 change: 1 addition & 0 deletions js/controllers/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@
$scope.macroOptions = {
waitTime: 3,
buffWaitTime: 2,
stepSoundEnabled: true,
stepSoundEffect: 1,
finishSoundEffect: 14
};
Expand Down
2 changes: 2 additions & 0 deletions locale/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@
"BUFF_WAIT_TIME_INFO": "设置每一个增益类操作之后的延时,延时太短可能会导致工序混乱,如果游戏网络延迟较高,可以适当增大这个数字。(默认值:2)",
"STEP_SOUND_EFFECT": "步骤宏执行完毕提示音",
"STEP_SOUND_INFO": "这里将会在每一个宏指令的末尾自动生成提示音语句(除了最后结束的一个宏指令之外),用于提示玩家该宏指令已经执行完毕。(范围:1-16;默认:1)",
"STEP_SOUND_ENABLED" : "Enable Sound Effects",
"STEP_SOUND_ENABLED_INFO" : "Enable or disable Sound Effects",
"FINISH_SOUND_EFFECT": "末尾宏执行完毕提示音",
"FINISH_SOUND_INFO": "这里将会在最后一个宏指令执行完毕后自动生成提示音语句,用于提示玩家最后一个宏指令已经执行完毕。(范围:1-16;默认:16)",
"CROSS_CLASS_INFO": "生成一个单独的宏指令来激活必要的“额外技能”。",
Expand Down
2 changes: 2 additions & 0 deletions locale/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@
"BUFF_WAIT_TIME_INFO": "Time to wait after each buff action.",
"STEP_SOUND_EFFECT": "Step Sound Effect",
"STEP_SOUND_INFO": "Sound effect to play at the end of each macro, except the last.,",
"STEP_SOUND_ENABLED" : "Enable Sound Effects",
"STEP_SOUND_ENABLED_INFO" : "Enable or disable Sound Effects",
"FINISH_SOUND_EFFECT": "Finish Sound Effect",
"FINISH_SOUND_INFO": "Sound effect to play at the end of the last macro.,",
"CROSS_CLASS_INFO": "Whether to generate a separate macro that activates the necessary cross-class actions.",
Expand Down
2 changes: 2 additions & 0 deletions locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@
"BUFF_WAIT_TIME_INFO": "Time to wait after each buff action.",
"STEP_SOUND_EFFECT": "Step Sound Effect",
"STEP_SOUND_INFO": "Sound effect to play at the end of each macro, except the last.,",
"STEP_SOUND_ENABLED" : "Enable Sound Effects",
"STEP_SOUND_ENABLED_INFO" : "Enable or disable Sound Effects",
"FINISH_SOUND_EFFECT": "Finish Sound Effect",
"FINISH_SOUND_INFO": "Sound effect to play at the end of the last macro.,",
"CROSS_CLASS_INFO": "Whether to generate a separate macro that activates the necessary cross-class actions.",
Expand Down
2 changes: 2 additions & 0 deletions locale/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@
"BUFF_WAIT_TIME_INFO": "Temps à attendre entre chaque action de type buff.",
"STEP_SOUND_EFFECT": "Effet sonore par étape",
"STEP_SOUND_INFO": "Effet sonore joué à la fin de chaque macro, sauf la dernière.",
"STEP_SOUND_ENABLED" : "Activer les effets sonores",
"STEP_SOUND_ENABLED_INFO" : "Activer ou désactiver les effets sonores dans les macros",
"FINISH_SOUND_EFFECT": "Effet sonore final",
"FINISH_SOUND_INFO": "Effet sonore joué à la fin de la dernière macro.",
"CROSS_CLASS_INFO": "Indique si il faut générer une macro séparée qui active les différentes actions cross-class nécessaires.",
Expand Down
2 changes: 2 additions & 0 deletions locale/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@
"BUFF_WAIT_TIME_INFO": "Time to wait after each buff action.",
"STEP_SOUND_EFFECT": "Step Sound Effect",
"STEP_SOUND_INFO": "Sound effect to play at the end of each macro, except the last.,",
"STEP_SOUND_ENABLED" : "Enable Sound Effects",
"STEP_SOUND_ENABLED_INFO" : "Enable or disable Sound Effects",
"FINISH_SOUND_EFFECT": "Finish Sound Effect",
"FINISH_SOUND_INFO": "Sound effect to play at the end of the last macro.,",
"CROSS_CLASS_INFO": "Whether to generate a separate macro that activates the necessary cross-class actions.",
Expand Down
2 changes: 2 additions & 0 deletions locale/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@
"BUFF_WAIT_TIME_INFO": "Time to wait after each buff action.",
"STEP_SOUND_EFFECT": "Step Sound Effect",
"STEP_SOUND_INFO": "Sound effect to play at the end of each macro, except the last.,",
"STEP_SOUND_ENABLED" : "Enable Sound Effects",
"STEP_SOUND_ENABLED_INFO" : "Enable or disable Sound Effects",
"FINISH_SOUND_EFFECT": "Finish Sound Effect",
"FINISH_SOUND_INFO": "Sound effect to play at the end of the last macro.,",
"CROSS_CLASS_INFO": "Whether to generate a separate macro that activates the necessary cross-class actions.",
Expand Down
12 changes: 10 additions & 2 deletions modals/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -211,24 +211,32 @@ <h3>{{ 'OPTIONS' | translate }}</h3>
</div>

<div class="span6">
<label class="checkbox" tooltip="{{ 'STEP_SOUND_ENABLED_INFO' | translate}}" tooltip-placement="left">
<input type="checkbox" name="setupSoundEnabled" ng-model="macroOptions.stepSoundEnabled"/>
{{ 'STEP_SOUND_ENABLED' | translate }}
</label>
<br/>

<div class="control-group">
<label for="macros.stepSoundEffect" class="control-label">{{ 'STEP_SOUND_EFFECT' | translate }}</label>
<label for="macros.stepSoundEffect" class="control-label" ng-class="{ disabled: !macroOptions.stepSoundEnabled }">{{ 'STEP_SOUND_EFFECT' | translate }}</label>

<div class="controls">
<input id="macros.stepSoundEffect" class="input-mini" type="number"
ng-model="macroOptions.stepSoundEffect"
min="1" max="16" required
ng-disabled="!macroOptions.stepSoundEnabled"
tooltip="{{ 'STEP_SOUND_INFO' | translate }}" tooltip-placement="left"/>
</div>
</div>

<div class="control-group">
<label for="macros.finishSoundEffect" class="control-label">{{ 'FINISH_SOUND_EFFECT' | translate }}</label>
<label for="macros.finishSoundEffect" class="control-label" ng-class="{ disabled: !macroOptions.stepSoundEnabled }">{{ 'FINISH_SOUND_EFFECT' | translate }}</label>

<div class="controls">
<input id="macros.finishSoundEffect" class="input-mini" type="number"
ng-model="macroOptions.finishSoundEffect"
min="1" max="16" required
ng-disabled="!macroOptions.stepSoundEnabled"
tooltip="{{ 'FINISH_SOUND_INFO' | translate }}" tooltip-placement="left"/>
</div>
</div>
Expand Down

0 comments on commit 9f94c32

Please sign in to comment.