fixes v12

This commit is contained in:
rwanoux
2024-06-24 08:41:59 +02:00
parent 9d74f5fe14
commit f4a56aa6b0
61 changed files with 485 additions and 422 deletions
+54 -60
View File
@@ -1,6 +1,6 @@
export class TotemPicker extends Application {
constructor(linkEl, actor) {
super();
this.linkEl = linkEl;
@@ -9,14 +9,14 @@ export class TotemPicker extends Application {
/* -------------------------------------------- */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
id:"TOTEM_PICKER",
title:game.i18n.localize("VERMINE.totem_picker"),
template:'systems/vermine2047/templates/applications/choose-totem.hbs',
popOut:true,
resizable:true,
height:"800",
width:"800"
return foundry.utils.mergeObject(super.defaultOptions, {
id: "TOTEM_PICKER",
title: game.i18n.localize("VERMINE.totem_picker"),
template: 'systems/vermine2047/templates/applications/choose-totem.hbs',
popOut: true,
resizable: true,
height: "800",
width: "800"
});
}
@@ -24,26 +24,20 @@ export class TotemPicker extends Application {
// Send data to the template
return {
config: CONFIG.VERMINE,
/*anarchy: this.gmAnarchy.getAnarchy(),
convergences: this.gmConvergence.getConvergences(),
difficultyPools: this.gmDifficulty.getDifficultyData(),
options: {
classes: [game.system.anarchy.styles.selectCssClass()]
}*/
}
}
activateListeners(html) {
super.activateListeners(html);
html.find('.totem').click(event => {
const totem = $(event.target).parent('a').data('totem');
if (totem != null){
this.actor.update({ 'system.identity.totem': totem });
}
this.close();
});
html.find('.totem').click(event => {
const totem = $(event.target).parent('a').data('totem');
if (totem != null) {
this.actor.update({ 'system.identity.totem': totem });
}
this.close();
});
}
/*async _updateObject(event, formData) {
// console.log(formData.exampleInput);
}*/
@@ -52,7 +46,7 @@ export class TotemPicker extends Application {
export class ActorPicker extends Application {
constructor(linkEl, actor) {
super();
this.linkEl = linkEl;
@@ -61,14 +55,14 @@ export class ActorPicker extends Application {
/* -------------------------------------------- */
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:"350",
width:"600"
return foundry.utils.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: "350",
width: "600"
});
}
@@ -78,49 +72,49 @@ export class ActorPicker extends Application {
// 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 all = game.actors.filter(a => a.type == "npc" || a.type == 'character');
const type = $(this.linkEl).data('type');
let actorsList = [];
if (type == 'members'){
if (type == 'members') {
actorsList = characters;
} else if (type == 'relations'){
actorsList = npc;
} else if (type == 'relations') {
actorsList = npc;//[...npc, ...characters];
} else {
actorsList = encounters;
actorsList = all;
}
return {
config: CONFIG.VERMINE,
actorsList: actorsList
config: CONFIG.VERMINE,
actorsList: actorsList
}
}
activateListeners(html) {
async activateListeners(html) {
super.activateListeners(html);
html.find('.actor').click(event => {
const actorId = $(event.target).parent('div').data('id');
const type = $(this.linkEl).data('type');
let actorsList = [];
html.find('.actor').click(async (event) => {
const actorId = $(event.target).parent('div').data('actor-id');
const type = $(this.linkEl).data('type');
let actorsList = [];
if (type == 'members'){
actorsList = this.actor.system.members;
} else if (type == 'encounters'){
actorsList = this.actor.system.encounters;
}
if (!Array.isArray(actorsList)){
actorsList = [];
}
if (type == 'members') {
actorsList = this.actor.system.members;
} else if (type == 'encounters') {
actorsList = this.actor.system.encounters;
}
if (!Array.isArray(actorsList)) {
actorsList = [];
}
actorsList.push(actorId);
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 });
}
if (type == 'members') {
actorsList = this.actor.system.members;
this.actor.update({ 'system.members': actorsList });
} else if (type == 'encounters') {
this.actor.update({ 'system.encounters': actorsList });
}
});
});
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
export async function initUserDice(dice3d, user) {
let baseColor = user.color;
let baseColor = user.color.css;
dice3d.addColorset({
name: 'regular_' + user.name,
description: "regular dice for " + user.name,
+1 -1
View File
@@ -42,7 +42,7 @@ export const registerHooks = function () {
if (rerollTitle) {
rerollTitle.addEventListener("click", () => { html[0].querySelector(".reroll").classList.toggle('visible') })
}
if (message.user._id != game.user._id || !game.user.isGM) {
if (message.author._id != game.user._id || !game.user.isGM) {
html[0].querySelectorAll("input").forEach(inp => inp.disabled = true);
html[0].querySelectorAll("div.reroll-from-effort").forEach(el => el.style.display = "none")
return
+144 -144
View File
@@ -1,157 +1,157 @@
function compact(array) {
var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
while (++index2 < length) {
var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
while (++index2 < length) {
var value2 = array[index2];
if (value2) {
result[resIndex++] = value2;
result[resIndex++] = value2;
}
}
return result;
}
return result;
}
class CreateActorDialog extends FormApplication {
constructor() {
super({});
}
async _updateObject() {
}
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
title: game.i18n.format("DOCUMENT.Create", {
type: game.i18n.localize("DOCUMENT.Actor")
}),
template: "systems/vermine2047/templates/actor/create.hbs",
id: "new-actor-dialog",
resizable: false,
classes: ["vermine2047", "sheet", "new-actor"],
width: 650,
height: 200
});
}
getData(_options) {
return {
// sfenabled: IronswornSettings.starforgedToolsEnabled
};
}
activateListeners(html) {
super.activateListeners(html);
html.find(".vermine__character__create").on("click", async (ev) => {
await this._characterCreate.call(this, ev);
});
html.find(".vermine__shared__create").on("click", async (ev) => {
await this._sharedCreate.call(this, ev);
});
html.find(".vermine__site__create").on("click", async (ev) => {
await this._siteCreate.call(this, ev);
});
html.find(".vermine__foe__create").on("click", async (ev) => {
await this._foeCreate.call(this, ev);
});
}
constructor() {
super({});
}
async _updateObject() {
}
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
title: game.i18n.format("DOCUMENT.Create", {
type: game.i18n.localize("DOCUMENT.Actor")
}),
template: "systems/vermine2047/templates/actor/create.hbs",
id: "new-actor-dialog",
resizable: false,
classes: ["vermine2047", "sheet", "new-actor"],
width: 650,
height: 200
});
}
getData(_options) {
return {
// sfenabled: IronswornSettings.starforgedToolsEnabled
};
}
activateListeners(html) {
super.activateListeners(html);
html.find(".vermine__character__create").on("click", async (ev) => {
await this._characterCreate.call(this, ev);
});
html.find(".vermine__shared__create").on("click", async (ev) => {
await this._sharedCreate.call(this, ev);
});
html.find(".vermine__site__create").on("click", async (ev) => {
await this._siteCreate.call(this, ev);
});
html.find(".vermine__foe__create").on("click", async (ev) => {
await this._foeCreate.call(this, ev);
});
}
}
class VermineTour extends Tour {
/** @override */
async _preStep() {
var _a2, _b, _c, _d, _e;
await super._preStep();
if ((_a2 = this.currentStep) == null ? void 0 : _a2.sidebarTab) {
await ((_b = ui.sidebar) == null ? void 0 : _b.activateTab(this.currentStep.sidebarTab));
}
if ((_c = this.currentStep) == null ? void 0 : _c.layer) {
const layer = canvas == null ? void 0 : canvas[this.currentStep.layer];
if (layer.active && this.currentStep.tool)
(_d = ui.controls) == null ? void 0 : _d.initialize({ tool: this.currentStep.tool });
else
layer.activate({ tool: this.currentStep.tool });
}
if (((_e = this.currentStep) == null ? void 0 : _e.hook) != null) {
await this.currentStep.hook();
}
/** @override */
async _preStep() {
var _a2, _b, _c, _d, _e;
await super._preStep();
if ((_a2 = this.currentStep) == null ? void 0 : _a2.sidebarTab) {
await ((_b = ui.sidebar) == null ? void 0 : _b.activateTab(this.currentStep.sidebarTab));
}
if ((_c = this.currentStep) == null ? void 0 : _c.layer) {
const layer = canvas == null ? void 0 : canvas[this.currentStep.layer];
if (layer.active && this.currentStep.tool)
(_d = ui.controls) == null ? void 0 : _d.initialize({ tool: this.currentStep.tool });
else
layer.activate({ tool: this.currentStep.tool });
}
if (((_e = this.currentStep) == null ? void 0 : _e.hook) != null) {
await this.currentStep.hook();
}
}
}
class WelcomeTour extends VermineTour {
constructor() {
super({
title: "TOURS.Welcome.Title",
description: "TOURS.Welcome.Description",
canBeResumed: false,
display: true,
steps: []
});
}
get steps() {
var _a2;
return compact([
{
id: "welcome",
title: "TOURS.Welcome.WelcomeTitle",
content: "TOURS.Welcome.WelcomeContent"
},
{
id: "character-tab",
title: "TOURS.Welcome.ActorTabTitle",
content: "TOURS.Welcome.ActorTabContent",
sidebarTab: "actors",
selector: "#actors .create-document"
},
{
id: "character-create",
title: "TOURS.Welcome.CharacterCreateTitle",
content: "TOURS.Welcome.CharacterCreateContent",
hook: async () => {
this.createActorDialog = new CreateActorDialog();
await this.createActorDialog.render(true);
await new Promise((r) => setTimeout(r, 100));
},
selector: "#new-actor-dialog #new-group"
},
/*{
id: "compendia",
title: "TOURS.Welcome.CompendiumTitle",
content: "TOURS.Welcome.CompendiumContent",
hook: async () => {
var _a3;
return await ((_a3 = this.createActorDialog) == null ? void 0 : _a3.close());
},
sidebarTab: "compendium",
selector: 'li[data-pack="vermine2047.verminescenes"]'
},*/
/*((_a2 = game.user) == null ? void 0 : _a2.viewedScene) && {
id: "oracletool",
title: "TOURS.Welcome.OracleToolTitle",
content: "TOURS.Welcome.OracleToolContent",
layer: "tokens",
selector: '[data-tool="Oracles"]'
},*/
{
id: "tours",
title: "TOURS.Welcome.ToursTitle",
content: "TOURS.Welcome.ToursContent",
hook: async () => {
var _a3;
return await ((_a3 = this.createActorDialog) == null ? void 0 : _a3.close());
},
sidebarTab: "settings",
selector: 'button[data-action="tours"]'
}
]);
}
constructor() {
super({
title: "TOURS.Welcome.Title",
description: "TOURS.Welcome.Description",
canBeResumed: false,
display: true,
steps: []
});
}
export async function registerTours() {
game.tours.register("vermine2047", "welcome", new WelcomeTour());
$(document).on("click", "#chat-log #vermine-tour-chat-button", (el) => {
const tour = game.tours.get("vermine2047.welcome");
tour == null ? void 0 : tour.start();
});
if (game.settings.get("vermine2047", "first-run-tips-shown"))
return;
console.log("Posting first-start messages...");
const gms = ChatMessage.getWhisperRecipients("GM");
ChatMessage.implementation;
ChatMessage.create({
whisper: gms,
speaker: { alias: game.i18n.localize("VERMINE.name") },
content: game.i18n.localize("TOURS.ChatMessage")
});
game.settings.set("vermine2047", "first-run-tips-shown", true);
}
get steps() {
var _a2;
return compact([
{
id: "welcome",
title: "TOURS.Welcome.WelcomeTitle",
content: "TOURS.Welcome.WelcomeContent"
},
{
id: "character-tab",
title: "TOURS.Welcome.ActorTabTitle",
content: "TOURS.Welcome.ActorTabContent",
sidebarTab: "actors",
selector: "#actors .create-document"
},
{
id: "character-create",
title: "TOURS.Welcome.CharacterCreateTitle",
content: "TOURS.Welcome.CharacterCreateContent",
hook: async () => {
this.createActorDialog = new CreateActorDialog();
await this.createActorDialog.render(true);
await new Promise((r) => setTimeout(r, 100));
},
selector: "#new-actor-dialog #new-group"
},
/*{
id: "compendia",
title: "TOURS.Welcome.CompendiumTitle",
content: "TOURS.Welcome.CompendiumContent",
hook: async () => {
var _a3;
return await ((_a3 = this.createActorDialog) == null ? void 0 : _a3.close());
},
sidebarTab: "compendium",
selector: 'li[data-pack="vermine2047.verminescenes"]'
},*/
/*((_a2 = game.user) == null ? void 0 : _a2.viewedScene) && {
id: "oracletool",
title: "TOURS.Welcome.OracleToolTitle",
content: "TOURS.Welcome.OracleToolContent",
layer: "tokens",
selector: '[data-tool="Oracles"]'
},*/
{
id: "tours",
title: "TOURS.Welcome.ToursTitle",
content: "TOURS.Welcome.ToursContent",
hook: async () => {
var _a3;
return await ((_a3 = this.createActorDialog) == null ? void 0 : _a3.close());
},
sidebarTab: "settings",
selector: 'button[data-action="tours"]'
}
]);
}
}
export async function registerTours() {
game.tours.register("vermine2047", "welcome", new WelcomeTour());
$(document).on("click", "#chat-log #vermine-tour-chat-button", (el) => {
const tour = game.tours.get("vermine2047.welcome");
tour == null ? void 0 : tour.start();
});
if (game.settings.get("vermine2047", "first-run-tips-shown"))
return;
console.log("Posting first-start messages...");
const gms = ChatMessage.getWhisperRecipients("GM");
ChatMessage.implementation;
ChatMessage.create({
whisper: gms,
speaker: { alias: game.i18n.localize("VERMINE.name") },
content: game.i18n.localize("TOURS.ChatMessage")
});
game.settings.set("vermine2047", "first-run-tips-shown", true);
}