diff --git a/assets/images/avatars/Vermine-Chef.png b/assets/images/avatars/Vermine-Chef.png new file mode 100644 index 0000000..3de1d55 Binary files /dev/null and b/assets/images/avatars/Vermine-Chef.png differ diff --git a/assets/images/avatars/Vermine-Clint.png b/assets/images/avatars/Vermine-Clint.png new file mode 100644 index 0000000..fed1a0f Binary files /dev/null and b/assets/images/avatars/Vermine-Clint.png differ diff --git a/assets/images/avatars/Vermine-Hima.png b/assets/images/avatars/Vermine-Hima.png new file mode 100644 index 0000000..96cced3 Binary files /dev/null and b/assets/images/avatars/Vermine-Hima.png differ diff --git a/assets/images/avatars/Vermine-Lana.png b/assets/images/avatars/Vermine-Lana.png new file mode 100644 index 0000000..ca3084e Binary files /dev/null and b/assets/images/avatars/Vermine-Lana.png differ diff --git a/assets/images/avatars/Vermine-Ombre.png b/assets/images/avatars/Vermine-Ombre.png new file mode 100644 index 0000000..d25c3d8 Binary files /dev/null and b/assets/images/avatars/Vermine-Ombre.png differ diff --git a/assets/images/avatars/Vermine-Rouge.png b/assets/images/avatars/Vermine-Rouge.png new file mode 100644 index 0000000..cf48ef7 Binary files /dev/null and b/assets/images/avatars/Vermine-Rouge.png differ diff --git a/module/sheets/actor-sheet.mjs b/module/sheets/actor-sheet.mjs index e72c673..e34d1be 100644 --- a/module/sheets/actor-sheet.mjs +++ b/module/sheets/actor-sheet.mjs @@ -253,7 +253,6 @@ export class VermineActorSheet extends ActorSheet { weapons.push(i); } else if (i.type === 'ability') { - console.log('ability', i); if (i.system.type == 'totem'){ totem_abilities.push(i); } else { diff --git a/module/sheets/npc-group.mjs b/module/sheets/npc-group.mjs index 0d81d27..2d77237 100644 --- a/module/sheets/npc-group.mjs +++ b/module/sheets/npc-group.mjs @@ -1,6 +1,6 @@ import {onManageActiveEffect, prepareActiveEffectCategories} from "../system/effects.mjs"; import { VermineActorSheet } from "./actor-sheet.mjs"; -import { TotemPicker } from "../system/applications.mjs"; +import { TotemPicker, ActorPicker } from "../system/applications.mjs"; /** * Extend the basic ActorSheet with some very simple modifications @@ -147,6 +147,9 @@ export class VermineGroupSheet extends VermineActorSheet { // Choose Totem html.find('.chooseTotem').click(this._onTotemButton.bind(this)); + // Choose Members / Encounters + html.find('.chooseActor').click(this._onRoadButton.bind(this)); + if (this.actor.isOwner) { let handler = ev => this._onDragStart(ev); html.find('li.item').each((i, li) => { @@ -230,4 +233,18 @@ export class VermineGroupSheet extends VermineActorSheet { totemPicker.render(true); } + /** + * Handle actor pick + * @param {Event} event The originating click event + * @private + */ + _onRoadButton(event) { + event.preventDefault(); + const el = event.currentTarget; + // const dataset = el.dataset; + + const actorPicker = new ActorPicker(el, this.actor); + actorPicker.render(true); + } + } diff --git a/module/system/applications.mjs b/module/system/applications.mjs index 46ae8b4..e19e1a7 100644 --- a/module/system/applications.mjs +++ b/module/system/applications.mjs @@ -22,7 +22,6 @@ export class TotemPicker extends Application { getData() { // Send data to the template - return { config: CONFIG.VERMINE, /*anarchy: this.gmAnarchy.getAnarchy(), @@ -49,3 +48,80 @@ export class TotemPicker extends Application { // console.log(formData.exampleInput); }*/ } + + +export class ActorPicker extends Application { + + + constructor(linkEl, actor) { + super(); + this.linkEl = linkEl; + this.actor = actor; + } + + /* -------------------------------------------- */ + static get defaultOptions() { + return mergeObject(super.defaultOptions, { + id:"ACTOR_PICKER", + title:game.i18n.localize("VERMINE.actor_picker"), + template:'systems/vermine2047/templates/applications/choose-actor.hbs', + popOut:true, + resizable:true, + height:"600", + width:"600" + }); + } + + + + getData() { + // Send data to the template + const npcs = game.actors.filter(a => a.type == "npc"); + const characters = game.actors.filter(a => a.type == "character"); + const encounters = game.actors.filter(a => a.type == "npc" || a.type == 'character'); + const type = $(this.linkEl).data('type'); + + let actorsList = []; + if (type == 'members'){ + actorsList = characters; + } else if (type == 'relations'){ + actorsList = npc; + } else { + actorsList = encounters; + } + return { + config: CONFIG.VERMINE, + actorsList: actorsList + } + } + + activateListeners(html) { + super.activateListeners(html); + html.find('.actor').click(event => { + const actorId = $(event.target).parent('div').data('id'); + let actorsList = []; + const type = $(this.linkEl).data('type'); + + if (type == 'members'){ + actorsList = this.actor.system.members; + } else if (type == 'encounters'){ + actorsList = this.actor.system.encounters; + } + if (!Array.isArray(actorsList)){ + actorsList = []; + } + console.log(actorsList, type, this.actor.system.encounters, this.actor.system.members); + actorsList.push(actorId); + + if (type == 'members'){ + actorsList = this.actor.system.members; + this.actor.update({ 'system.members': actorsList }); + } else if (type == 'encounters'){ + this.actor.update({ 'system.encounters': actorsList }); + } + console.log(actorsList); + + }); + } + +} diff --git a/template.json b/template.json index c99b348..dddd3c9 100644 --- a/template.json +++ b/template.json @@ -379,7 +379,8 @@ "min": 1, "max": 7 }, - "members": [] + "members": [], + "encounters": [] }, "creature": { "templates": ["base"], diff --git a/templates/actor/parts/group-experience.hbs b/templates/actor/parts/group-experience.hbs index bcee159..3cee2f7 100644 --- a/templates/actor/parts/group-experience.hbs +++ b/templates/actor/parts/group-experience.hbs @@ -1,6 +1,9 @@