-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from EddieDover/only-online
Adds ability to show any characters as well as only logged-in characters.
- Loading branch information
Showing
11 changed files
with
230 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
export class HiddenCharactersSettings extends FormApplication { | ||
constructor(overrides) { | ||
super(); | ||
this.overrides = overrides || {}; | ||
} | ||
|
||
getData(options) { | ||
this.characterList = game.actors.filter(actor => actor.type !== "npc").map(actor => actor.name); | ||
const hiddenCharacters = game.settings.get("theater-of-the-mind", "hiddenCharacters"); | ||
const enableOnlyOnline = game.settings.get("theater-of-the-mind", "enableOnlyOnline"); | ||
|
||
return mergeObject(super.getData(options), { | ||
characters: this.characterList, | ||
hiddenCharacters, | ||
enableOnlyOnline, | ||
overrides: this.overrides | ||
}); | ||
} | ||
|
||
static get defaultOptions() { | ||
return foundry.utils.mergeObject(super.defaultOptions, { | ||
id: "totm-hidden-characters-settings", | ||
classes: ["form"], | ||
title: "Configure Hidden Characters", | ||
template: "modules/theater-of-the-mind/templates/hidden-characters.html", | ||
width: 'auto', | ||
height: 300, | ||
}); | ||
} | ||
|
||
saveHiddenCharacters(event) { | ||
const hiddenCharacters = []; | ||
for (const character of this.characterList) { | ||
const checkbox = document.getElementById(`hidden-character-${character}`); | ||
if (checkbox.checked) { | ||
hiddenCharacters.push(character); | ||
} | ||
} | ||
game.settings.set("theater-of-the-mind", "hiddenCharacters", hiddenCharacters); | ||
const closefunc = this.overrides?.onexit; | ||
if (closefunc) { | ||
closefunc(); | ||
} | ||
super.close(); | ||
} | ||
|
||
resetEffects() { | ||
// this.effects = game.settings.settings.get('monks-little-details.additional-effects').default; | ||
this.refresh(); | ||
} | ||
|
||
activateListeners(html) { | ||
super.activateListeners(html); | ||
$('button[name="submit"]', html).click(this.saveHiddenCharacters.bind(this)); | ||
$('button[name="reset"]', html).click(this.resetEffects.bind(this)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { HiddenCharactersSettings } from "./hidden-characters-settings"; | ||
|
||
export const registerSettings = () => { | ||
game.settings.register('theater-of-the-mind', 'hiddenCharacters', { | ||
"scope":"world", | ||
"config": false, | ||
"default": [], | ||
"type": Array | ||
}); | ||
|
||
game.settings.register("theater-of-the-mind", "enableOnlyOnline", { | ||
"name": "theater-of-the-mind.settings.enable-only-online.name", | ||
"hint": "theater-of-the-mind.settings.enable-only-online.hint", | ||
"scope": "world", | ||
"config": true, | ||
"default": true, | ||
"type": Boolean | ||
}); | ||
|
||
game.settings.registerMenu("theater-of-the-mind", "configureHiddenCharacters", { | ||
"name": "", | ||
"label": "Edit Displayed Characters", | ||
"hint": "Edit which characters are displayed if not showing online characters.", | ||
"icon": "fas fa-user", | ||
"restricted": true, | ||
"type": HiddenCharactersSettings | ||
}); | ||
|
||
game.settings.register("theater-of-the-mind", "enableDarkMode", { | ||
"name": "theater-of-the-mind.settings.enable-dark-mode.name", | ||
"hint": "theater-of-the-mind.settings.enable-dark-mode.hint", | ||
"scope": "world", | ||
"config": true, | ||
"default": false, | ||
"type": Boolean, | ||
"onChange": () => { | ||
// Hooks.call("renderSceneControls"); | ||
}, | ||
}); | ||
|
||
game.settings.register("theater-of-the-mind", "enableSounds", { | ||
"name": "theater-of-the-mind.settings.enable-sounds.name", | ||
"hint": "theater-of-the-mind.settings.enable-sounds.hint", | ||
"scope": "world", | ||
"config": true, | ||
"default": false, | ||
"type": Boolean | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.