This commit is contained in:
François-Xavier Guillois
2023-08-25 10:36:25 +02:00
parent 7aeef29e34
commit 641d2a892a
29 changed files with 238 additions and 19 deletions
-14
View File
@@ -156,9 +156,6 @@ export class VermineCharacterSheet extends VermineActorSheet {
// Active Effect management
html.find(".effect-control").click(ev => onManageActiveEffect(ev, this.actor));
// test print dice
// html.find(".skill").change(ev => this.printSkillLevels(ev, this.actor));
// Rollable abilities.
html.find('.rollable').click(this._onRoll.bind(this));
@@ -173,17 +170,6 @@ export class VermineCharacterSheet extends VermineActorSheet {
}
}
/*printSkillLevels(event){
const newLevel = event.target.value;
const levelData = CONFIG.VERMINE.SkillLevels[newLevel] || null;
if (levelData != null){
console.log(/*levelData.dicePool, levelData.reroll, game.i18n.localize(levelData.label), * /$(event.target).parent().find('.die.pool').get(0), $(event.target).parent().find('.die.reroll').get(0));
$(event.target).parent().find('.die.pool').text(levelData.dicePool);
$(event.target).parent().find('.die.reroll').text(levelData.reroll);
}
} */
/**
* Handle creating a new Owned Item for the actor using initial data defined in the HTML dataset
* @param {Event} event The originating click event
+3 -1
View File
@@ -1,3 +1,4 @@
import { registerTours } from "./tour.mjs";
export const registerHooks = function () {
/**
@@ -6,6 +7,7 @@ export const registerHooks = function () {
Hooks.once("ready", async () => {
console.info("Vermine 2047 | System Initialized.");
await registerTours();
});
// changement de la pause
@@ -58,7 +60,7 @@ export const registerHooks = function () {
Hooks.on("preCreateItem", function (item) {
if (item.img == "icons/svg/item-bag.svg") {
item.updateSource({"img": `systems/vermine2047/icons/items/${item.type}.webp`});
item.updateSource({"img": `systems/vermine2047/assets/icons/items/${item.type}.webp`});
// item.updateSource({"img": `systems/vermine2047/icons/competence.webp`});
}
});
+11 -2
View File
@@ -1,7 +1,7 @@
export const registerSettings = function () {
game.settings.register("vermine2047", "game-mode", {
name: game.i18n.localize("VERMINE.WorldSettings.GameMode.Name"),
hint: game.i18n.localize("VERMINE.WorldSettings.GameMode.Hint"),
name: game.i18n.localize("SETTINGS.world.game_mode.name"),
hint: game.i18n.localize("SETTINGS.world.game_mode.hint"),
scope: "system",
config: true,
type: String,
@@ -15,4 +15,13 @@ export const registerSettings = function () {
// console.log(value);
}
});
game.settings.register("vermine2047", "first-run-tips-shown", {
name: game.i18n.localize("SETTINGS.world.first_run.name"),
hint: game.i18n.localize("SETTINGS.world.first_run.hint"),
scope: "system",
config: true,
type: Boolean,
default: false
});
}
+157
View File
@@ -0,0 +1,157 @@
function compact(array) {
var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
while (++index2 < length) {
var value2 = array[index2];
if (value2) {
result[resIndex++] = value2;
}
}
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);
});
}
}
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();
}
}
}
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"]'
}
]);
}
}
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);
}