diff --git a/.styles/generic.css b/.styles/generic.css new file mode 100644 index 0000000..2bd4bf8 --- /dev/null +++ b/.styles/generic.css @@ -0,0 +1,59 @@ +@import url("https://fonts.googleapis.com/css2?family=Pixelify+Sans&display=swap"); +.dotdungeon > .window-content ::-webkit-scrollbar { + width: 10px; +} +.dotdungeon > .window-content ::-webkit-scrollbar-thumb { + border-radius: 5px; +} +.dotdungeon > .window-content h2, .dotdungeon > .window-content h3, .dotdungeon > .window-content h4, .dotdungeon > .window-content h5, .dotdungeon > .window-content h6 { + all: initial; + display: block; + box-sizing: border-box; + font-family: "Pixelify Sans", sans-serif; + margin: 0; +} +.dotdungeon > .window-content label { + cursor: pointer; +} +.dotdungeon > .window-content button, .dotdungeon > .window-content button:hover { + all: initial; + display: block; + box-sizing: border-box; + font-family: inherit; + cursor: pointer; +} +.dotdungeon > .window-content input[type=text], +.dotdungeon > .window-content input[type=number], +.dotdungeon > .window-content textarea { + padding: 5px 7px; + border-width: 2px; + border-radius: 4px; + border-style: solid; + border-color: rgba(0, 0, 0, 0.4); + background-color: rgba(0, 0, 0, 0.1); + font-family: sans-serif; +} +.dotdungeon > .window-content input[type=text]:focus, .dotdungeon > .window-content input[type=text]:active, +.dotdungeon > .window-content input[type=number]:focus, +.dotdungeon > .window-content input[type=number]:active, +.dotdungeon > .window-content textarea:focus, +.dotdungeon > .window-content textarea:active { + border-color: rgb(0, 0, 0); +} +.dotdungeon > .window-content select, .dotdungeon > .window-content select:hover { + cursor: pointer; +} +.dotdungeon > .window-content .debug-data { + opacity: 60%; + font-family: sans-serif; +} + +.dotdungeon { + container-type: size; +} +.dotdungeon > .window-content { + padding: 0; + background: #f2f2f2; +} + +/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../styles/generic.scss%22,%22../styles/mixins/_foundry.scss%22,%22../styles/_vars.scss%22,%22../styles/mixins/_partials.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAIQ;AAKP;EACC;;AAED;EACC;;AAGD;ECfA;EACA;EACA;EDeC,aElBW;EFmBX;;AAGD;EACC;;AAGD;ECzBA;EACA;EACA;EDyBC;EACA;;AAGD;AAAA;AAAA;EAGC;EGhCD;EACA;EACA;EACA;EACA;EACA,aDPW;;ACSX;AAAA;AAAA;AAAA;AAAA;EAEC;;AH2BD;EACC;;AAGD;EACC;EACA,aE5CU;;;AFiDZ;EACC;;AAEA;EACC;EACA,YEpDW%22,%22file%22:%22generic.css%22%7D */ diff --git a/.styles/root.css b/.styles/root.css index aa6001d..79a6216 100644 --- a/.styles/root.css +++ b/.styles/root.css @@ -9,12 +9,10 @@ all: initial; display: block; box-sizing: border-box; - display: block; font-family: "Pixelify Sans", sans-serif; margin: 0; } .dotdungeon > .window-content label { - display: inline-block; cursor: pointer; } .dotdungeon > .window-content button, .dotdungeon > .window-content button:hover { @@ -27,9 +25,6 @@ .dotdungeon > .window-content input[type=text], .dotdungeon > .window-content input[type=number], .dotdungeon > .window-content textarea { - all: initial; - display: block; - box-sizing: border-box; padding: 5px 7px; border-width: 2px; border-radius: 4px; @@ -95,7 +90,6 @@ } .dotdungeon .panel__header { background: black; - color: white; display: flex; flex-direction: row; justify-content: center; @@ -107,7 +101,7 @@ all: initial; display: block; box-sizing: border-box; - color: inherit; + color: white; flex-grow: 1; font-family: "Pixelify Sans", sans-serif; font-size: 20px; @@ -186,6 +180,10 @@ .dotdungeon .actor--pc .panel--sync .sync__header { flex-grow: 1; } +.dotdungeon .actor--pc .panel--sync .sync__input { + width: 80px; + margin: 3px 5px; +} .dotdungeon .actor--pc .panel--aspect { grid-area: aspect; } @@ -241,6 +239,37 @@ flex-direction: column; } } +.dotdungeon .actor--circle-sync { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + gap: 4px; +} +.dotdungeon .actor--circle-sync label { + display: flex; + flex-direction: column; + align-items: center; +} +.dotdungeon .actor--circle-sync .sync-input { + width: 30%; + text-align: center; +} +.dotdungeon .actor--circle-sync .name-input { + width: 60%; + text-align: center; +} +.dotdungeon--sync-sheet header .configure-token { + display: none; + visibility: hidden; +} + +@container (max-width: 300px) { + .dotdungeon--sync-sheet header .configure-sheet { + display: none; + visibility: hidden; + } +} .dotdungeon .item--aspect { padding: 4px; } @@ -254,4 +283,4 @@ resize: vertical; } -/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../styles/root.scss%22,%22../styles/mixins/_foundry.scss%22,%22../styles/_vars.scss%22,%22../styles/mixins/_partials.scss%22,%22../styles/sheets/partials/stat.scss%22,%22../styles/sheets/partials/skill.scss%22,%22../styles/sheets/partials/panel.scss%22,%22../styles/mixins/_breakpoints.scss%22,%22../styles/sheets/actor/mvp.scss%22,%22../styles/sheets/items/aspect.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAIQ;AAKP;EACC;;AAED;EACC;;AAGD;ECfA;EACA;EACA;EDeC;EACA,aEnBW;EFoBX;;AAGD;EACC;EACA;;AAGD;EC3BA;EACA;EACA;ED2BC;EACA;;AAGD;AAAA;AAAA;ECjCA;EACA;EACA;EDmCC;EGnCD;EACA;EACA;EACA;EACA;EACA,aDPW;;ACSX;AAAA;AAAA;AAAA;AAAA;EAEC;;AH8BD;EACC;;AAGD;EACC;EACA,aE/CU;;;AFoDZ;EACC;;AAEA;EACC;EACA,YEvDW;;;AEHb;EACC;EACA;EACA;;ACHD;EACC;EACA;EACA;EACA;EACA;EACA;;AAEA;EACC;EACA;EACA;EACA;;AAEA;EACC;EACA;EACA;EACA;;;ACdH;EACC;EACA;EAEA;EACA;;AAEA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;ELpBD;EACA;EACA;EKoBE;EACA;EACA,aJzBU;EI0BV;;AAGD;EAEC,QADO;EAEP,OAFO;EAGP;;AAIF;EACC;;;AC/BD;EDoCA;IACC;IACA;;;AE1CF;EACC;EACA,qBACC;EASD;EACA,oBACC;EAGD;EACA;;AAGC;EACC;;AACA;EACC;EACA;;AAGD;EACC;;AAGF;EACC;;AACA;EACC;EACA;EACA;EACA;EACA;EACA;;AAGF;EACC;;AAEA;EACC;EACA;EACA;EACA;;AAGF;EACC;;AAED;EACC;;AAEA;EACC;EACA;EACA;;AAGD;AAAA;EAEC;EACA;EACA;;AAEA;AAAA;EACC;;AAIH;EACC;;AACA;EACC;EACA;EACA;EACA;;AAGF;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;;ADvGF;EC+GC;IACC;IACA;IACA,qBACC;;EAgBD;IACC;;EAGC;IACC;;EAKD;IACC;IACA;;;ADzIL;ECmJC;IACC;IACA;IACA,qBACC;;EAeC;IACC;;;AC5KN;EACC;;AAEA;EACC;EACA;EACA;;AAGD;EACC;EACA%22,%22file%22:%22root.css%22%7D */ +/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../styles/generic.scss%22,%22../styles/mixins/_foundry.scss%22,%22../styles/_vars.scss%22,%22../styles/mixins/_partials.scss%22,%22../styles/sheets/partials/stat.scss%22,%22../styles/sheets/partials/skill.scss%22,%22../styles/sheets/partials/panel.scss%22,%22../styles/mixins/_breakpoints.scss%22,%22../styles/sheets/actor/mvp.scss%22,%22../styles/sheets/actor/sync/basic.scss%22,%22../styles/sheets/items/aspect.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAIQ;AAKP;EACC;;AAED;EACC;;AAGD;ECfA;EACA;EACA;EDeC,aElBW;EFmBX;;AAGD;EACC;;AAGD;ECzBA;EACA;EACA;EDyBC;EACA;;AAGD;AAAA;AAAA;EAGC;EGhCD;EACA;EACA;EACA;EACA;EACA,aDPW;;ACSX;AAAA;AAAA;AAAA;AAAA;EAEC;;AH2BD;EACC;;AAGD;EACC;EACA,aE5CU;;;AFiDZ;EACC;;AAEA;EACC;EACA,YEpDW;;;AEHb;EACC;EACA;EACA;;ACHD;EACC;EACA;EACA;EACA;EACA;EACA;;AAEA;EACC;EACA;EACA;EACA;;AAEA;EACC;EACA;EACA;EACA;;;ACdH;EACC;EACA;EAEA;EACA;;AAEA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;ELnBD;EACA;EACA;EKmBE;EACA;EACA,aJxBU;EIyBV;;AAGD;EAEC,QADO;EAEP,OAFO;EAGP;;AAIF;EACC;;;AC9BD;EDmCA;IACC;IACA;;;AEzCF;EACC;EACA,qBACC;EASD;EACA,oBACC;EAGD;EACA;;AAGC;EACC;;AACA;EACC;EACA;;AAGD;EACC;;AAGF;EACC;;AACA;EACC;EACA;EACA;EACA;EACA;EACA;;AAGF;EACC;;AAEA;EACC;EACA;EACA;EACA;;AAGF;EACC;;AAED;EACC;;AAEA;EACC;EACA;EACA;;AAGD;AAAA;EAEC;EACA;EACA;;AAEA;AAAA;EACC;;AAIF;EACC;EACA;;AAGF;EACC;;AACA;EACC;EACA;EACA;EACA;;AAGF;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;;AD5GF;ECoHC;IACC;IACA;IACA,qBACC;;EAgBD;IACC;;EAGC;IACC;;EAKD;IACC;IACA;;;AD9IL;ECwJC;IACC;IACA;IACA,qBACC;;EAeC;IACC;;;AChLL;EACC;EACA;EACA;EACA;EACA;;AAEA;EACC;EACA;EACA;;AAGD;EACC;EACA;;AAGD;EACC;EACA;;AAMA;EACC;EACA;;;AFlBH;EE4BG;IACC;IACA;;;ACzCL;EACC;;AAEA;EACC;EACA;EACA;;AAGD;EACC;EACA%22,%22file%22:%22root.css%22%7D */ diff --git a/.styles/sheets/actor/mvp.css b/.styles/sheets/actor/mvp.css index 598c075..15c36c6 100644 --- a/.styles/sheets/actor/mvp.css +++ b/.styles/sheets/actor/mvp.css @@ -57,6 +57,10 @@ .dotdungeon .actor--pc .panel--sync .sync__header { flex-grow: 1; } +.dotdungeon .actor--pc .panel--sync .sync__input { + width: 80px; + margin: 3px 5px; +} .dotdungeon .actor--pc .panel--aspect { grid-area: aspect; } @@ -113,4 +117,4 @@ } } -/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../../../styles/sheets/actor/mvp.scss%22,%22../../../styles/mixins/_breakpoints.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAGA;EACC;EACA,qBACC;EASD;EACA,oBACC;EAGD;EACA;;AAGC;EACC;;AACA;EACC;EACA;;AAGD;EACC;;AAGF;EACC;;AACA;EACC;EACA;EACA;EACA;EACA;EACA;;AAGF;EACC;;AAEA;EACC;EACA;EACA;EACA;;AAGF;EACC;;AAED;EACC;;AAEA;EACC;EACA;EACA;;AAGD;AAAA;EAEC;EACA;EACA;;AAEA;AAAA;EACC;;AAIH;EACC;;AACA;EACC;EACA;EACA;EACA;;AAGF;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;;ACvGF;ED+GC;IACC;IACA;IACA,qBACC;;EAgBD;IACC;;EAGC;IACC;;EAKD;IACC;IACA;;;ACzIL;EDmJC;IACC;IACA;IACA,qBACC;;EAeC;IACC%22,%22file%22:%22mvp.css%22%7D */ +/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../../../styles/sheets/actor/mvp.scss%22,%22../../../styles/mixins/_breakpoints.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAGA;EACC;EACA,qBACC;EASD;EACA,oBACC;EAGD;EACA;;AAGC;EACC;;AACA;EACC;EACA;;AAGD;EACC;;AAGF;EACC;;AACA;EACC;EACA;EACA;EACA;EACA;EACA;;AAGF;EACC;;AAEA;EACC;EACA;EACA;EACA;;AAGF;EACC;;AAED;EACC;;AAEA;EACC;EACA;EACA;;AAGD;AAAA;EAEC;EACA;EACA;;AAEA;AAAA;EACC;;AAIF;EACC;EACA;;AAGF;EACC;;AACA;EACC;EACA;EACA;EACA;;AAGF;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;AAED;EACC;;;AC5GF;EDoHC;IACC;IACA;IACA,qBACC;;EAgBD;IACC;;EAGC;IACC;;EAKD;IACC;IACA;;;AC9IL;EDwJC;IACC;IACA;IACA,qBACC;;EAeC;IACC%22,%22file%22:%22mvp.css%22%7D */ diff --git a/.styles/sheets/actor/sync.css b/.styles/sheets/actor/sync.css new file mode 100644 index 0000000..83ee62d --- /dev/null +++ b/.styles/sheets/actor/sync.css @@ -0,0 +1,19 @@ +.dotdungeon .actor--sync { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; +} +.dotdungeon .actor--sync .sync-input { + width: 30%; + text-align: center; +} + +@container (max-width: 400px) { + .dotdungeon--sync-sheet header .configure-sheet, + .dotdungeon--sync-sheet header .configure-token { + display: none; + } +} + +/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../../../styles/sheets/actor/sync.scss%22,%22../../../styles/mixins/_breakpoints.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAGC;EACC;EACA;EACA;EACA;;AAEA;EACC;EACA;;;ACJF;EDaG;AAAA;IAEC%22,%22file%22:%22sync.css%22%7D */ diff --git a/.styles/sheets/actor/sync/basic.css b/.styles/sheets/actor/sync/basic.css new file mode 100644 index 0000000..f6d24bb --- /dev/null +++ b/.styles/sheets/actor/sync/basic.css @@ -0,0 +1,33 @@ +.dotdungeon .actor--circle-sync { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + gap: 4px; +} +.dotdungeon .actor--circle-sync label { + display: flex; + flex-direction: column; + align-items: center; +} +.dotdungeon .actor--circle-sync .sync-input { + width: 30%; + text-align: center; +} +.dotdungeon .actor--circle-sync .name-input { + width: 60%; + text-align: center; +} +.dotdungeon--sync-sheet header .configure-token { + display: none; + visibility: hidden; +} + +@container (max-width: 300px) { + .dotdungeon--sync-sheet header .configure-sheet { + display: none; + visibility: hidden; + } +} + +/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../../../../styles/sheets/actor/sync/basic.scss%22,%22../../../../styles/mixins/_breakpoints.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAGC;EACC;EACA;EACA;EACA;EACA;;AAEA;EACC;EACA;EACA;;AAGD;EACC;EACA;;AAGD;EACC;EACA;;AAMA;EACC;EACA;;;AClBH;ED4BG;IACC;IACA%22,%22file%22:%22basic.css%22%7D */ diff --git a/.styles/sheets/partials/panel.css b/.styles/sheets/partials/panel.css index d7dad46..a2b4091 100644 --- a/.styles/sheets/partials/panel.css +++ b/.styles/sheets/partials/panel.css @@ -6,7 +6,6 @@ } .dotdungeon .panel__header { background: black; - color: white; display: flex; flex-direction: row; justify-content: center; @@ -18,7 +17,7 @@ all: initial; display: block; box-sizing: border-box; - color: inherit; + color: white; flex-grow: 1; font-family: "Pixelify Sans", sans-serif; font-size: 20px; @@ -39,4 +38,4 @@ } } -/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../../../styles/sheets/partials/panel.scss%22,%22../../../styles/mixins/_foundry.scss%22,%22../../../styles/_vars.scss%22,%22../../../styles/mixins/_breakpoints.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAIA;EACC;EACA;EAEA;EACA;;AAEA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;ECpBD;EACA;EACA;EDoBE;EACA;EACA,aEzBU;EF0BV;;AAGD;EAEC,QADO;EAEP,OAFO;EAGP;;AAIF;EACC;;;AG/BD;EHoCA;IACC;IACA%22,%22file%22:%22panel.css%22%7D */ +/*# sourceMappingURL=data:application/json;charset=utf-8,%7B%22version%22:3,%22sourceRoot%22:%22%22,%22sources%22:%5B%22../../../styles/sheets/partials/panel.scss%22,%22../../../styles/mixins/_foundry.scss%22,%22../../../styles/_vars.scss%22,%22../../../styles/mixins/_breakpoints.scss%22%5D,%22names%22:%5B%5D,%22mappings%22:%22AAIA;EACC;EACA;EAEA;EACA;;AAEA;EACC;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;ECnBD;EACA;EACA;EDmBE;EACA;EACA,aExBU;EFyBV;;AAGD;EAEC,QADO;EAEP,OAFO;EAGP;;AAIF;EACC;;;AG9BD;EHmCA;IACC;IACA%22,%22file%22:%22panel.css%22%7D */ diff --git a/langs/en-ca.json b/langs/en-ca.json index c52c648..35d064d 100644 --- a/langs/en-ca.json +++ b/langs/en-ca.json @@ -1,12 +1,20 @@ { "dotdungeon.settings.showAvatarOnSheet.name": "Show Avatar On Player Sheet", "dotdungeon.settings.showAvatarOnSheet.description": "Determines whether or not to show the avatar to you on the Player Character sheets, turning this off will replace the image with a file picker so that you can still change the image from the character sheet.", + "dotdungeon.settings.playersCanChangeGroup.name": "Allow Players to Change Group", + "dotdungeon.settings.playersCanChangeGroup.description": "Setting this to true allows non-GM players to modify the group that the Actor belongs to. While this is disabled the GM will still be able to modify each player's group by editing the character sheet.", + "dotdungeon.settings.resourcesOrSupplies.name": "Use Resources or Supplies", + "dotdungeon.settings.resourcesOrSupplies.description": "Determines which term to use for the objects that allow travelling into the next hex tile. This is because of the", + "dotdungeon.settings.resourcesOrSupplies.option.supplies": "Resources", + "dotdungeon.settings.resourcesOrSupplies.option.resources": "Supplies", - "dotdungeon.sheet.PlayerSheet": "PC Sheet", + "dotdungeon.sheet.PlayerSheet": "PC/PUG Sheet", + "dotdungeon.sheet.SyncSheet.basic": "Theme: Basic", "dotdungeon.sheet.AspectSheet": "Aspect Sheet", "TYPES.Actor.player": "Player", + "TYPES.Actor.sync": "Sync", "TYPES.Item.aspect": "Aspect", "TYPES.Item.weapon": "Weapon", "TYPES.Item.armour": "Armour", @@ -68,20 +76,29 @@ "dotdungeon.actor.pc.skill.piloting": "Piloting", "dotdungeon.actor.pc.respawns.header": "Respawns", + "dotdungeon.actor.pc.sync.header": "Sync", "dotdungeon.actor.pc.profile.avatar.label": "Avatar", "dotdungeon.actor.pc.profile.group.label": "Group Name", + "dotdungeon.actor.pc.profile.group.gm-edit": "(GM Only)", "dotdungeon.actor.pc.profile.group.placeholder": "Group Name...", "dotdungeon.actor.pc.profile.name.label": "Character Name", "dotdungeon.actor.pc.profile.name.placeholder": "Character Name...", + "dotdungeon.actor.sync.circle.group": "Group Name", + "dotdungeon.actor.sync.circle.sync": "Sync", + + "dotdungeon.item.aspect.name": "Name", "dotdungeon.item.aspect.duration": "Duration (seconds)", "dotdungeon.item.aspect.description": "Description", "dotdungeon.item.aspect.send-to-chat": "Send Aspect to Chat", + "dotdungeon.notification.error.invalid-integer": "You must enter a valid whole number.", + + "dotdungeon.aria.skill.dropdown": "Your expertise level in the {skill} skill", "dotdungeon.aria.skill.button.roll": "Roll a {skill} check", "dotdungeon.aria.aspect-description": "The information on how the aspect works" diff --git a/module/dotdungeon.js b/module/dotdungeon.js index 4b0b91d..b767541 100644 --- a/module/dotdungeon.js +++ b/module/dotdungeon.js @@ -1,6 +1,7 @@ // Data Models import { AspectItemData } from "./models/AspectItemData.mjs"; import { PlayerData } from "./models/PlayerData.mjs"; +import { SyncData } from "./models/SyncData.mjs"; // Main Documents import { PlayerActor } from "./documents/PlayerActor.mjs"; @@ -9,7 +10,7 @@ import { AspectItem } from "./documents/AspectItem.mjs"; // Character Sheets import { AspectSheet } from "./sheets/AspectSheet.mjs"; import { PlayerSheet } from "./sheets/PlayerSheet.mjs"; - +import { BasicSyncSheet } from "./sheets/SyncVariations/BasicSyncSheet.mjs"; // Utility imports import * as hbs from "./handlebars.mjs"; @@ -17,7 +18,6 @@ import * as hbs from "./handlebars.mjs"; // Non-Setup hooks import "./hooks/hotReload.mjs"; - // Misc Imports import loadSettings from "./settings/index.mjs"; @@ -32,12 +32,26 @@ Hooks.once(`init`, () => { AspectItem, }; CONFIG.Actor.dataModels.player = PlayerData; + CONFIG.Actor.dataModels.sync = SyncData; CONFIG.Item.dataModels.aspect = AspectItemData; Actors.unregisterSheet("core", ActorSheet); - Actors.registerSheet("dotdungeon.sheet", PlayerSheet, { makeDefault: true }); + Actors.registerSheet("dotdungeon", PlayerSheet, { + makeDefault: true, + types: ["player"], + label: "dotdungeon.sheet.PlayerSheet" + }); + Actors.registerSheet("dotdungeon", BasicSyncSheet, { + makeDefault: true, + types: ["sync"], + label: "dotdungeon.sheet.SyncSheet.basic" + }); - Items.registerSheet("dotdungeon.sheet", AspectSheet, { makeDefault: true }); + Items.registerSheet("dotdungeon", AspectSheet, { + makeDefault: true, + types: ["aspect"], + label: "dotdungeon.sheet.AspectSheet" + }); hbs.registerHandlebarsHelpers(); hbs.preloadHandlebarsTemplates(); diff --git a/module/hooks/hotReload.mjs b/module/hooks/hotReload.mjs index 3150fb8..832686f 100644 --- a/module/hooks/hotReload.mjs +++ b/module/hooks/hotReload.mjs @@ -1,4 +1,3 @@ -import { reloadWindows } from "../utils.mjs"; import * as hbs from "../handlebars.mjs"; Hooks.on(`hotReload`, async (data) => { @@ -25,7 +24,9 @@ Hooks.on(`hotReload`, async (data) => { _templateCache[templateName] = template; // Re-render open windows - reloadWindows(); + for (const window of ui.windows) { + window.render(true); + }; return false; }); \ No newline at end of file diff --git a/module/models/PlayerData.mjs b/module/models/PlayerData.mjs index bb3a9d9..0672ee7 100644 --- a/module/models/PlayerData.mjs +++ b/module/models/PlayerData.mjs @@ -78,8 +78,18 @@ export class PlayerData extends foundry.abstract.DataModel { cells: new fields.NumberField({ min: 0, max: 5, integer: true }), }), }), - supplies: new fields.NumberField({ min: 0, max: 5, integer: true }), - materials: new fields.NumberField({ min: 0, max: 5, integer: true }), + supplies: new fields.NumberField({ + initial: 0, + min: 0, + max: 5, + integer: true + }), + materials: new fields.NumberField({ + initial: 0, + min: 0, + max: 5, + integer: true + }), pet: new fields.SchemaField({ name: new fields.HTMLField(), info: new fields.HTMLField(), @@ -102,7 +112,9 @@ export class PlayerData extends foundry.abstract.DataModel { r3: new fields.BooleanField(), }), syncDelta: new fields.NumberField({ + required: true, integer: true, + initial: 0, }), }; }; diff --git a/module/models/SyncData.mjs b/module/models/SyncData.mjs new file mode 100644 index 0000000..8a60988 --- /dev/null +++ b/module/models/SyncData.mjs @@ -0,0 +1,12 @@ +export class SyncData extends foundry.abstract.DataModel { + static defineSchema() { + const fields = foundry.data.fields; + return { + value: new fields.NumberField({ + required: true, + integer: true, + initial: 100, + }), + }; + }; +}; \ No newline at end of file diff --git a/module/settings/index.mjs b/module/settings/index.mjs index bd590ca..0a0b83f 100644 --- a/module/settings/index.mjs +++ b/module/settings/index.mjs @@ -1,7 +1,9 @@ import registerClientSettings from "./client_settings.mjs"; +import registerWorldSettings from "./world_settings.mjs"; import registerDevSettings from "./dev_settings.mjs"; export default function registerSettings() { registerClientSettings(); + registerWorldSettings(); registerDevSettings(); }; \ No newline at end of file diff --git a/module/settings/world_settings.mjs b/module/settings/world_settings.mjs new file mode 100644 index 0000000..9e7d928 --- /dev/null +++ b/module/settings/world_settings.mjs @@ -0,0 +1,25 @@ +export default function() { + game.settings.register(`dotdungeon`, `playersCanChangeGroup`, { + name: `dotdungeon.settings.playersCanChangeGroup.name`, + hint: `dotdungeon.settings.playersCanChangeGroup.description`, + scope: `world`, + config: true, + type: Boolean, + default: false, + requiresReload: false, + }); + + game.settings.register(`dotdungeon`, `resourcesOrSupplies`, { + name: `dotdungeon.settings.resourcesOrSupplies.name`, + hint: `dotdungeon.settings.resourcesOrSupplies.description`, + scope: `world`, + config: true, + type: String, + choices: { + "supplies": "dotdungeon.settings.resourcesOrSupplies.option.supplies", + "resources": "dotdungeon.settings.resourcesOrSupplies.option.resources" + }, + default: "resources", + requiresReload: false, + }); +}; \ No newline at end of file diff --git a/module/sheets/GenericSheet.mjs b/module/sheets/GenericSheet.mjs index cb67430..95279c5 100644 --- a/module/sheets/GenericSheet.mjs +++ b/module/sheets/GenericSheet.mjs @@ -1,7 +1,8 @@ export class GenericSheet extends ActorSheet { #propogatedSettings = [ `devMode`, - `showAvatarOnSheet` + `showAvatarOnSheet`, + `playersCanChangeGroup`, ]; getData() { diff --git a/module/sheets/PlayerSheet.mjs b/module/sheets/PlayerSheet.mjs index 604ed6d..68d60c4 100644 --- a/module/sheets/PlayerSheet.mjs +++ b/module/sheets/PlayerSheet.mjs @@ -19,7 +19,35 @@ export class PlayerSheet extends GenericSheet { if (!this.isEditable) return; console.debug(`.dungeon | Adding event listeners for Actor: ${this.id}`); - // html.find(`input.sync__input`).on("blur", ($e) => {}); + // html.find(`input.sync__input`).on("blur", ($e) => { + // console.debug(`.dungeon | input.sync__input blur event`); + + // let value = parseInt($e.target.value); + // if (!value) { + // ui.notifications.error( + // `dotdungeon.notification.error.invalid-integer`, + // { localize: true } + // ); + // return; + // }; + // let delta = value - this.#syncValue(); + // this.actor.system.syncDelta += delta; + // for (const actor of game.actors) { + // if (actor._sheet) + // } + // game.socket.emit(`system.dotdungeon`, { + // type: "reload", + + // }) + // }); + }; + + #syncValue() { + let delta = 0; + for (const actor of game.actors) { + delta += actor.system.syncDelta ?? 0; + }; + return 100 + delta; }; getData() { @@ -30,7 +58,8 @@ export class PlayerSheet extends GenericSheet { ctx.flags = actor.flags; ctx.computed = { - syncTotal: 0 + syncTotal: this.#syncValue(), + canChangeGroup: ctx.settings.playersCanChangeGroup, }; console.groupCollapsed(`PlayerSheet.getData`); diff --git a/module/sheets/SyncVariations/AbstractSyncSheet.mjs b/module/sheets/SyncVariations/AbstractSyncSheet.mjs new file mode 100644 index 0000000..15cfd8d --- /dev/null +++ b/module/sheets/SyncVariations/AbstractSyncSheet.mjs @@ -0,0 +1,32 @@ +import { GenericSheet } from "../GenericSheet.mjs"; + +export class AbstractSyncSheet extends GenericSheet { + static get defaultOptions() { + let opts = mergeObject( + super.defaultOptions, + { + width: 200, + height: 200, + } + ); + opts.classes.push( + `dotdungeon`, + `dotdungeon--sync-sheet` + ); + return opts; + }; + + getData() { + const ctx = super.getData(); + const actor = this.actor.toObject(false); + + ctx.system = actor.system; + ctx.flags = actor.flags; + + console.groupCollapsed(`SyncSheet.getData`); + console.log(`ctx`, ctx); + console.log(`actor`, actor); + console.groupEnd(); + return ctx; + }; +}; \ No newline at end of file diff --git a/module/sheets/SyncVariations/BasicSyncSheet.mjs b/module/sheets/SyncVariations/BasicSyncSheet.mjs new file mode 100644 index 0000000..197b95b --- /dev/null +++ b/module/sheets/SyncVariations/BasicSyncSheet.mjs @@ -0,0 +1,7 @@ +import { AbstractSyncSheet } from "./AbstractSyncSheet.mjs"; + +export class BasicSyncSheet extends AbstractSyncSheet { + get template() { + return `systems/dotdungeon/templates/actors/sync/basic.hbs`; + }; +}; \ No newline at end of file diff --git a/module/utils.mjs b/module/utils.mjs index 8ad7c32..7d63d62 100644 --- a/module/utils.mjs +++ b/module/utils.mjs @@ -1,11 +1,11 @@ export function reloadWindows(type = null) { if (!type) { - for (const window of ui.windows) { + for (const window of globalThis.ui.windows) { window.render(true); }; return; }; - for (const window of ui.windows) { + for (const window of globalThis.ui.windows) { if (window instanceof type) { window.render(true); }; diff --git a/styles/generic.scss b/styles/generic.scss new file mode 100644 index 0000000..6cf08bd --- /dev/null +++ b/styles/generic.scss @@ -0,0 +1,58 @@ +@use "./mixins/partials" as *; +@use "./mixins/foundry" as *; +@use "./vars.scss" as *; + +@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans&display=swap'); + +// Reset the parts of Foundry's styling which gets in the way of what I want +.dotdungeon > .window-content { + + ::-webkit-scrollbar { + width: 10px; + } + ::-webkit-scrollbar-thumb { + border-radius: 5px; + } + + h2, h3, h4, h5, h6 { + @include fvtt_reset; + font-family: $title-font; + margin: 0; + } + + label { + cursor: pointer; + } + + button, button:hover { + @include fvtt_reset; + font-family: inherit; + cursor: pointer; + } + + input[type="text"], + input[type="number"], + textarea { + padding: 5px 7px; + @include input-generic; + } + + select, select:hover { + cursor: pointer; + } + + .debug-data { + opacity: 60%; + font-family: $body-font; + } +} + +// Styling that doesn't belong to any particular part of my sheet +.dotdungeon { + container-type: size; + + > .window-content { + padding: 0; + background: $background; + } +} \ No newline at end of file diff --git a/styles/mixins/_breakpoints.scss b/styles/mixins/_breakpoints.scss index 4041288..3f7a4da 100644 --- a/styles/mixins/_breakpoints.scss +++ b/styles/mixins/_breakpoints.scss @@ -8,4 +8,10 @@ @container (max-width: 400px) { @content }; -}; \ No newline at end of file +}; + +@mixin bp-xs { + @container (max-width: 300px) { + @content + } +} \ No newline at end of file diff --git a/styles/root.scss b/styles/root.scss index e8a1408..cc79693 100644 --- a/styles/root.scss +++ b/styles/root.scss @@ -2,67 +2,12 @@ @use "./mixins/foundry" as *; @use "./vars.scss" as *; -@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans&display=swap'); +@use "./generic.scss"; -// Reset the parts of Foundry's styling which gets in the way of what I want -.dotdungeon > .window-content { +@use "./sheets/partials/stat.scss"; +@use "./sheets/partials/skill.scss"; +@use "./sheets/partials/panel.scss"; - ::-webkit-scrollbar { - width: 10px; - } - ::-webkit-scrollbar-thumb { - border-radius: 5px; - } - - h2, h3, h4, h5, h6 { - @include fvtt_reset; - display: block; - font-family: $title-font; - margin: 0; - } - - label { - display: inline-block; - cursor: pointer; - } - - button, button:hover { - @include fvtt_reset; - font-family: inherit; - cursor: pointer; - } - - input[type="text"], - input[type="number"], - textarea { - @include fvtt_reset; - padding: 5px 7px; - @include input-generic; - } - - select, select:hover { - cursor: pointer; - } - - .debug-data { - opacity: 60%; - font-family: $body-font; - } -} - -// Styling that doesn't belong to any particular part of my sheet -.dotdungeon { - container-type: size; - - > .window-content { - padding: 0; - background: $background; - } -} - -@import "./sheets/partials/stat.scss"; -@import "./sheets/partials/skill.scss"; -@import "./sheets/partials/panel.scss"; - -@import "./sheets/actor/mvp.scss"; -@import "./sheets/items/aspect.scss"; \ No newline at end of file +@use "./sheets/actor/mvp.scss"; +@use "./sheets/actor/sync/basic.scss"; +@use "./sheets/items/aspect.scss"; \ No newline at end of file diff --git a/styles/sheets/actor/mvp.scss b/styles/sheets/actor/mvp.scss index 95b0c6f..fed80d8 100644 --- a/styles/sheets/actor/mvp.scss +++ b/styles/sheets/actor/mvp.scss @@ -76,6 +76,11 @@ flex-grow: 1; } } + + .sync__input { + width: 80px; + margin: 3px 5px; + } } &--aspect { grid-area: aspect; diff --git a/styles/sheets/actor/sync/basic.scss b/styles/sheets/actor/sync/basic.scss new file mode 100644 index 0000000..9c49110 --- /dev/null +++ b/styles/sheets/actor/sync/basic.scss @@ -0,0 +1,49 @@ +@use "../../../mixins/breakpoints" as *; + +.dotdungeon { + .actor--circle-sync { + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + gap: 4px; + + label { + display: flex; + flex-direction: column; + align-items: center; + } + + .sync-input { + width: 30%; + text-align: center; + } + + .name-input { + width: 60%; + text-align: center; + } + } + + &--sync-sheet { + header { + .configure-token { + display: none; + visibility: hidden; + } + } + } +} + +@include bp-xs { + .dotdungeon { + &--sync-sheet { + header { + .configure-sheet { + display: none; + visibility: hidden; + } + } + } + } +} \ No newline at end of file diff --git a/styles/sheets/partials/panel.scss b/styles/sheets/partials/panel.scss index ee8d682..2dacc26 100644 --- a/styles/sheets/partials/panel.scss +++ b/styles/sheets/partials/panel.scss @@ -11,7 +11,6 @@ &__header { background: black; - color: white; display: flex; flex-direction: row; justify-content: center; @@ -21,7 +20,7 @@ h2 { @include fvtt_reset; - color: inherit; + color: white; flex-grow: 1; font-family: $title-font; font-size: 20px; diff --git a/templates/actors/char-sheet-mvp/sheet.hbs b/templates/actors/char-sheet-mvp/sheet.hbs index 226c76d..d6e718a 100644 --- a/templates/actors/char-sheet-mvp/sheet.hbs +++ b/templates/actors/char-sheet-mvp/sheet.hbs @@ -27,15 +27,20 @@ placeholder="{{localize "dotdungeon.actor.pc.profile.name.placeholder"}}" > - + {{#if computed.canChangeGroup}} + + {{/if}} {{/ dotdungeon.panel}} @@ -64,23 +69,30 @@ {{#> dotdungeon.panel class="sync" title="dotdungeon.actor.pc.panel.sync"}} + {{!-- + NOTE: This would be neat to get working at some point, but isn't my highest + priority to do. +

- Sync + {{localize "dotdungeon.actor.pc.sync.header"}} {{#if settings.devMode}} ({{system.syncDelta}}) {{/if}}

- {{!-- --}} + >
+ --}}
-

{{localize "dotdungeon.actor.pc.respawns.header"}}

+

+ {{localize "dotdungeon.actor.pc.respawns.header"}} +

{{#each system.respawns}} + + + \ No newline at end of file