Skip to content

Commit

Permalink
v2.5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mclemente committed Apr 8, 2021
1 parent a608408 commit 08aeb13
Show file tree
Hide file tree
Showing 10 changed files with 214 additions and 148 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
## 2.5.1.0
- Fixed an issue with a setting not loading correctly.
- Moved settings related to death into its own category.
- Aggregated the four "Only show estimations to" settings into a single setting.

## 2.5.0.4
- Added support to Star Wars FFG.

Expand Down
25 changes: 10 additions & 15 deletions lang/en.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
{
"healthEstimate": {
"core": {
"onlyGM": {
"name": "GM only",
"hint": "Only show estimations to GM."
},
"onlyNotGM": {
"name": "Players only",
"hint": "Only show estimations to players."
},
"onlyNPCs": {
"name": "NPCs only",
"hint": "Only show estimations for NPCs, but not for player characters. This setting only affects players."
},
"onlyPCs": {
"name": "PCs only",
"hint": "Only show estimations for PCs, but not for non-player characters. This setting only affects players."
"showDescription": {
"name": "Show Estimates",
"hint": "Show estimates to the selected users.",
"choices": {
"all": "All",
"GM": "Only to GM",
"Players": "Only to Players",
"NPC": "Only to Players (NPC estimates only)",
"PC": "Only to Players (PC estimates only)"
}
},
"stateNames": {
"name": "Stages",
Expand Down
27 changes: 11 additions & 16 deletions lang/pt-BR.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
{
"healthEstimate": {
"core": {
"onlyGM": {
"name": "Apenas o Mestre",
"hint": "Mostra os descritores somente ao Mestre."
},
"onlyNotGM": {
"name": "Apenas os jogadores",
"hint": "Mostra os descritores somente aos jogadores."
},
"onlyNPCs": {
"name": "Apenas NPCs",
"hint": "Mostra os descritores somente dos NPCs. Esta configuração afeta apenas aos jogadores."
},
"onlyPCs": {
"name": "Apenas PJs",
"hint": "Mostra os descritores somente dos PJs. Esta configuração afeta apenas aos jogadores."
"showDescription": {
"name": "Mostrar Estimativas",
"hint": "Mostra as estimativas para os usuários selecionados.",
"choices": {
"all": "Todos",
"GM": "Apenas para o Mestre",
"Players": "Apenas para Jogadores",
"NPC": "Apenas para Jogadores (Apenas estiamtivas de NPC)",
"PC": "Apenas para Jogadores (Apenas estiamtivas de PJ)"
}
},
"stateNames": {
"name": "Estágios",
Expand All @@ -35,7 +30,7 @@
},
"deathStateName": {
"name": "Descritor de morte",
"hint": "O descritor mostrado quando o personagem está morto. A guia Compendium possui uma macro para marcar um token (ou vários) como morto.",
"hint": "O descritor mostrado quando o personagem está morto. A aba Pacotes de Compêndio possui uma macro para marcar tokens como mortos.",
"default": "Morto"
},
"deathMarker": {
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "healthEstimate",
"title": "Health Estimate 2",
"description": "Gives players ability to see approximate health status of a token",
"version": "2.5.0.4",
"version": "2.5.1.0",
"author": "MClemente, Shylight",
"scripts": [
"./lib/chroma.min.js",
Expand Down
57 changes: 57 additions & 0 deletions module/deathSettings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import {sGet, sSet, settingData} from './utils.js'
import {updateSettings} from './logic.js'

export class HealthEstimateDeathSettings extends FormApplication {

constructor (object, options = {}) {
super(object, options)
this.gradFn = new Function()
this.gradColors = []
}

/**
* Default Options for this FormApplication
*/
static get defaultOptions () {
return mergeObject(super.defaultOptions, {
id : 'healthestimate-death-form',
title : 'Health Estimate Death Settings',
template : './modules/healthEstimate/templates/deathSettings.hbs',
classes : ['sheet'],
width : 640,
height : "auto",
closeOnSubmit: true
})
}

getData (options) {

function prepSetting (key) {
let data = settingData(`core.${key}`)
return {
value: sGet(`core.${key}`),
name : data.name,
hint : data.hint
}
}

return {
deathState : prepSetting('deathState'),
deathStateName : prepSetting('deathStateName'),
NPCsJustDie : prepSetting('NPCsJustDie'),
deathMarker : prepSetting('deathMarker'),
}
}

/**
* Executes on form submission
* @param {Event} e - the form submission event
* @param {Object} d - the form data
*/
async _updateObject(e,d) {
const iterableSettings = Object.keys(d);
for (let key of iterableSettings) {
sSet(`core.${key}`, d[key]);
}
}
}
75 changes: 42 additions & 33 deletions module/settings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {t} from './utils.js'
import {systemSpecificSettings, updateBreakSettings} from './systemSpecifics.js'
import {updateBreakSettings} from './systemSpecifics.js'
import {updateSettings} from './logic.js'
import {HealthEstimateStyleSettings} from './styleSettings.js'
import {HealthEstimateDeathSettings} from './deathSettings.js'

/**
* Shorthand for addSetting.
Expand Down Expand Up @@ -44,73 +45,81 @@ export const registerSettings = function () {
type: HealthEstimateStyleSettings,
restricted: true
})

game.settings.registerMenu('healthEstimate', 'deathSettings', {
name: 'Death Settings',
label: 'Death Settings',
icon: 'fas fa-skull',
type: HealthEstimateDeathSettings,
restricted: true
})

/* Settings for the main settings menu */
addSetting('core.onlyGM', {
type: Boolean,
default: false,
addSetting('core.showDescription', {
type: Number,
default: 0,
choices: {
0 : t('core.showDescription.choices.all'),
1 : t('core.showDescription.choices.GM'),
2 : t('core.showDescription.choices.Players'),
3 : t('core.showDescription.choices.NPC'),
4 : t('core.showDescription.choices.PC')
},
onChange: () => {
updateBreakSettings()
}
})
addSetting('core.onlyNotGM', {
type: Boolean,
default: false,
onChange: () => {
updateBreakSettings()
addSetting('core.stateNames', {
type: String,
default: t('core.stateNames.default').join(', '),
onChange: s => {
updateSettings()
}
})
addSetting('core.onlyNPCs', {
addSetting('core.perfectionism', {
type: Boolean,
default: false,
onChange: () => {
updateBreakSettings()
onChange: s => {
updateSettings()
}
})
addSetting('core.onlyPCs', {
addSetting('core.outputChat', {
type: Boolean,
default: false,
onChange: () => {
updateBreakSettings()
onChange: s => {
updateSettings()
}
})
addSetting('core.stateNames', {
type: String,
default: t('core.stateNames.default').join(', '),
onChange: s => {

/* Settings for the death menu */
addMenuSetting('core.deathState', {
'type' : Boolean,
'default': false,
onChange : s => {
updateSettings()
}
})
addSetting('core.deathStateName', {
addMenuSetting('core.deathStateName', {
type: String,
default: t('core.deathStateName.default'),
onChange: s => {
updateSettings()
}
})
addSetting('core.NPCsJustDie', {
addMenuSetting('core.NPCsJustDie', {
type: Boolean,
default: true,
onChange: s => {
updateSettings()
}
})
addSetting('core.perfectionism', {
type: Boolean,
default: false,
onChange: s => {
updateSettings()
}
})
addSetting('core.outputChat', {
type: Boolean,
default: false,
addMenuSetting('core.deathMarker', {
type : String,
default : 'icons/svg/skull.svg',
onChange: s => {
updateSettings()
}
})


/* Settings for the custom menu */
addMenuSetting('core.menuSettings.useColor', {
Expand Down
Loading

0 comments on commit 08aeb13

Please sign in to comment.