Skip to content

Commit

Permalink
update documentation, remove redundant files
Browse files Browse the repository at this point in the history
  • Loading branch information
esheyw committed Jan 23, 2024
1 parent 58545ac commit d3c3109
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 95 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,11 @@
- add `log` and `mhlog` helpers

## Version 0.2.1
- fix changelog
- fix changelog

## Version 0.2.2
- switch to SASS for styling
- add SASS compilation to github actions
- remove `isEmpty` helper, I didn't realize there was already one in `foundry.utils`
- implement new version of updateInitiativeStatistics
- document updateInitiativeStatistics
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Implements the Relic Gift of the same name. Prompts the user to select a weapon,
For recovering weapons hidden in flags by the old Lashing Currents macro originally shipped with the PF2e Relics module.
#### Drop Held Torch (`async dropHeldTorch()`) *Requires Item Piles*
Requires one token only selected, and a currently held torch. Creates an Item Pile containing the torch, removing it from the actor. If the torch was lit, apply that light to the resulting pile token. Significant generalization and improvements planned.
#### Update Initiative Statistics (`async updateInitiativeStatistics()`)
Provides a dialog to quickly set which statistic the actors of any/all selected tokens use for initiative.
![](https://i.imgur.com/8j80cOL.png)
(styling not final)

## Helper Functions
Helpers are accessed via `game.pf2emhl.`
Expand Down Expand Up @@ -50,14 +54,6 @@ Returns an `Error` with the message having been passed through `localize()` as a
Localizes `str` with `data`, preprends `prefix`, and calls `ui.notifications[type]` with the result and `console`. Errors if `type` is not `info`, `warn`, or `error`. If `notify` is nullish, falls back on the module setting, as above. If `log` is provided and is an object, it will be passed to `console[type]()`. `notify` functions as above.
#### `MHLError(str, data = {}, { notify = null, prefix = "MacroHelperLibrary: ", log = {}, func = null } = {})`
A simple wrapper on `localizedError` above, pre-fills the prefix for this library's calls, and provides the `func` variable which, if provided, is inserted between the prefix and the rest of the error string, for more a more granular 'where did this error come from' report.
#### `isEmpty(value)`
Checks if value is empty. Deep-checks arrays and objects.
```js
isEmpty([]) == true
isEmpty({}) == true
isEmpty([{0:false},"",0]) == true
isEmpty({0:1}) == false
```
#### `log(loggable, type = null, prefix = null)`
Passes `loggable` to `console[type]()`, with `prefix` as a separate argument first for ease of console filtering.
#### `mhlog(loggable, type = null, prefix="MHL |") `
Expand Down
4 changes: 2 additions & 2 deletions scripts/classes/MHLDialog.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { COLOURS, LABELABLE_TAGS, fu } from "../constants.mjs";
import { MHLError, isEmpty, localizedBanner } from "../helpers/errorHelpers.mjs";
import { MHLError, localizedBanner } from "../helpers/errorHelpers.mjs";
import { localize } from "../helpers/stringHelpers.mjs";
const PREFIX = "MHL.Dialog";
export class MHLDialog extends Dialog {
Expand All @@ -17,7 +17,7 @@ export class MHLDialog extends Dialog {
const fields = fu.deepClone(validator);
data.validator = (html) => {
const formValues = MHLDialog.getFormData(html);
const emptyFields = fields.filter((f) => isEmpty(formValues[f]));
const emptyFields = fields.filter((f) => fu.isEmpty(formValues[f]));
if (emptyFields.length) {
const fieldsError = fields
.map((f) =>
Expand Down
59 changes: 0 additions & 59 deletions scripts/macros/updateInitiativeSkills.mjs

This file was deleted.

25 changes: 0 additions & 25 deletions templates/updateInitiativeSkills.hbs

This file was deleted.

0 comments on commit d3c3109

Please sign in to comment.