Compare commits
No commits in common. "e340a68cff25cdb4238258f271dcd197dd0b98f5" and "76674f410e262f68bc2951394a89ffd1ff67a6f2" have entirely different histories.
e340a68cff
...
76674f410e
@ -159,8 +159,6 @@ html {
|
||||
}
|
||||
|
||||
&.chat-targets {
|
||||
margin-top: 0.5em;
|
||||
|
||||
& img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
@ -168,12 +166,11 @@ html {
|
||||
|
||||
& .target {
|
||||
display: grid;
|
||||
grid-template-columns: max-content minmax(0, max-content) auto max-content;
|
||||
grid-template-columns: max-content minmax(0, max-content) auto minmax(min-content, max-content);
|
||||
gap: 0.5em;
|
||||
align-items: center;
|
||||
|
||||
& button {
|
||||
grid-column: 4;
|
||||
grid-column: 3;
|
||||
line-height: normal;
|
||||
}
|
||||
}
|
||||
|
||||
45
src/main.mjs
45
src/main.mjs
@ -1,29 +1,17 @@
|
||||
const { TypeDataModel } = foundry.abstract;
|
||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
const { DocumentSheetConfig } = foundry.applications.apps;
|
||||
const { loadTemplates, renderTemplate } = foundry.applications.handlebars;
|
||||
const { ActorSheetV2, ItemSheetV2 } = foundry.applications.sheets;
|
||||
const { Notifications } = foundry.applications.ui;
|
||||
const { SchemaField, NumberField, StringField, BooleanField } = foundry.data.fields;
|
||||
const { Roll } = foundry.dice;
|
||||
const { ActorSheetV2, ItemSheetV2 } = foundry.applications.sheets;
|
||||
const { ApplicationV2, HandlebarsApplicationMixin } = foundry.applications.api;
|
||||
const { OperatorTerm, NumericTerm } = foundry.dice.terms;
|
||||
const { ChatMessage } = foundry.documents;
|
||||
|
||||
Hooks.once("i18nInit", async function() {
|
||||
const lang = game.i18n.lang;
|
||||
|
||||
await game.i18n.setLanguage("de");
|
||||
const fallback = game.i18n.translations;
|
||||
await game.i18n.setLanguage(lang);
|
||||
|
||||
game.i18n._fallback = foundry.utils.mergeObject(fallback, game.i18n.fallback);
|
||||
game.i18n._fallback = foundry.utils.mergeObject(await game.i18n._getTranslations("de"), game.i18n._fallback);
|
||||
});
|
||||
|
||||
class DSA41_Notifications extends Notifications {
|
||||
notify(message, type="info", {localize=false, permanent=false, console=true}={}) {
|
||||
if (permanent && message === "ERROR.RESOLUTION.Window")
|
||||
if (permanent && message.startsWith("Foundry Virtual Tabletop requires a minimum screen resolution"))
|
||||
return;
|
||||
|
||||
return super.notify(message, type, { localize, permanent, console });
|
||||
}
|
||||
}
|
||||
@ -58,6 +46,7 @@ Hooks.once("init", async function() {
|
||||
|
||||
CONFIG.statusEffects = [];
|
||||
|
||||
DocumentSheetConfig.unregisterSheet(Actor, "core", ActorSheet);
|
||||
DocumentSheetConfig.registerSheet(Actor, "dsa41", DSA41_ActorSheet, {
|
||||
makeDefault: true,
|
||||
types: [
|
||||
@ -65,6 +54,7 @@ Hooks.once("init", async function() {
|
||||
]
|
||||
});
|
||||
|
||||
DocumentSheetConfig.unregisterSheet(Item, "core", ItemSheet);
|
||||
DocumentSheetConfig.registerSheet(Item, "dsa41", DSA41_ItemSheetV2, {
|
||||
makeDefault: true,
|
||||
types: [
|
||||
@ -142,8 +132,9 @@ class DSA41_ChatMessage extends ChatMessage {
|
||||
return game.actors.get(this.speaker.actor);
|
||||
}
|
||||
|
||||
async renderHTML({ canDelete, canClose=false, ...rest }={}) {
|
||||
const html = await super.renderHTML({ canDelete, canClose, ...rest });
|
||||
async getHTML() {
|
||||
const html = (await super.getHTML())[0];
|
||||
if (!html) return;
|
||||
|
||||
const img = this.actor?.img ?? this.author.avatar;
|
||||
const name = this.alias;
|
||||
@ -152,8 +143,8 @@ class DSA41_ChatMessage extends ChatMessage {
|
||||
const sender = html.querySelector(".message-sender");
|
||||
sender?.replaceChildren(header);
|
||||
|
||||
if (this.flags.dsa41?.type === "trefferpunkte" && this.flags.dsa41?.targets?.length != 0) {
|
||||
const targets = this.flags.dsa41?.targets.map(x => fromUuidSync(x, { strict: false })).filter(x => x !== null);
|
||||
if (this.flags.type === "trefferpunkte" && this.flags.targets.length != 0) {
|
||||
const targets = this.flags.targets.map(x => fromUuidSync(x, { strict: false })).filter(x => x !== null);
|
||||
const targets_list = await instantiateTemplate("TrefferpunkteTargets", targets);
|
||||
|
||||
html.querySelector(".message-content")?.appendChild(targets_list);
|
||||
@ -892,10 +883,8 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||
flavor: flavor,
|
||||
flags: {
|
||||
dsa41: {
|
||||
type: roll_type,
|
||||
targets: get_targeted_actors(),
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@ -971,10 +960,8 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||
flavor: flavor,
|
||||
flags: {
|
||||
dsa41: {
|
||||
type: roll_type,
|
||||
targets: get_targeted_actors(),
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@ -1000,10 +987,8 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||
flavor: flavor,
|
||||
flags: {
|
||||
dsa41: {
|
||||
type: roll_type,
|
||||
targets: get_targeted_actors(),
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@ -1024,10 +1009,8 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||
flavor: flavor,
|
||||
flags: {
|
||||
dsa41: {
|
||||
type: roll_type,
|
||||
targets: get_targeted_actors(),
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@ -1048,10 +1031,8 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||
flavor: game.i18n.localize("DSA41.roll_types." + roll_type),
|
||||
flags: {
|
||||
dsa41: {
|
||||
type: roll_type,
|
||||
targets: get_targeted_actors(),
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@ -1072,10 +1053,8 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||
flavor: game.i18n.localize("DSA41.roll_types." + roll_type),
|
||||
flags: {
|
||||
dsa41: {
|
||||
type: roll_type,
|
||||
targets: get_targeted_actors(),
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@ -1087,10 +1066,8 @@ class DSA41_ActorSheet extends DSA41_ApplicationMixin(ActorSheetV2) {
|
||||
speaker: ChatMessage.getSpeaker({ actor: this.document }),
|
||||
flavor: flavor,
|
||||
flags: {
|
||||
dsa41: {
|
||||
type: roll_type,
|
||||
targets: get_targeted_actors(),
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@ -65,8 +65,8 @@
|
||||
],
|
||||
|
||||
"compatibility": {
|
||||
"minimum": "13",
|
||||
"verified": "13"
|
||||
"minimum": "12",
|
||||
"verified": "12"
|
||||
},
|
||||
|
||||
"version": "0.1.5",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user