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