Skip to content

Commit

Permalink
Before Consequence refactor into TargetLink
Browse files Browse the repository at this point in the history
  • Loading branch information
Eunomiac committed Jan 25, 2024
1 parent 05cbb75 commit 64a3825
Show file tree
Hide file tree
Showing 32 changed files with 1,005 additions and 845 deletions.
13 changes: 13 additions & 0 deletions DASHBOARD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Project Dashboard

## TypeScript Files

- [BladesProjectSheet](./ts/sheets/item/BladesProjectSheet.ts)

## SCSS Files

- [Example SCSS File](./path/to/your/scss/file.scss)

## Handlebars Files

- [Example Handlebars File](./path/to/your/handlebars/file.hbs)
Binary file removed assets/fonts/SmallPixel.ttf
Binary file not shown.
Binary file removed assets/fonts/TeenyTinyPixls.ttf
Binary file not shown.
8 changes: 0 additions & 8 deletions css/fonts.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@
font-style: italic;
font-weight: bold;
}
@font-face {
font-family: "Micro";
src: url("../assets/fonts/SmallPixel.ttf") format("truetype");
}
@font-face {
font-family: "Tiny";
src: url("../assets/fonts/TeenyTinyPixls.ttf") format("truetype");
}
@font-face {
font-family: "Minion Pro";
src: url("../assets/fonts/MinionPro/MinionPro.otf") format("opentype");
Expand Down
8 changes: 0 additions & 8 deletions css/style.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -391,14 +391,6 @@ template {
font-style: italic;
font-weight: bold;
}
@font-face {
font-family: "Micro";
src: url("../assets/fonts/SmallPixel.ttf") format("truetype");
}
@font-face {
font-family: "Tiny";
src: url("../assets/fonts/TeenyTinyPixls.ttf") format("truetype");
}
@font-face {
font-family: "Minion Pro";
src: url("../assets/fonts/MinionPro/MinionPro.otf") format("opentype");
Expand Down
8 changes: 0 additions & 8 deletions css/tinymce/fonts.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@
font-style: italic;
font-weight: bold;
}
@font-face {
font-family: "Micro";
src: url("../assets/fonts/SmallPixel.ttf") format("truetype");
}
@font-face {
font-family: "Tiny";
src: url("../assets/fonts/TeenyTinyPixls.ttf") format("truetype");
}
@font-face {
font-family: "Minion Pro";
src: url("../assets/fonts/MinionPro/MinionPro.otf") format("opentype");
Expand Down
2 changes: 1 addition & 1 deletion module/blades.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,10 @@ Hooks.once("init", async () => {
Director: BladesDirector.getInstance(),
Tooltips: new WeakMap()
};
eLog.display("Initializing Blades In the Dark System");
// Register System Settings
registerSettings();
CONFIG.debug.hooks = U.getSetting("debugHooks");
eLog.display("Initializing Blades In the Dark System");
// Initialize Fonts & Gsap Animations
GsapInitialize();
CONFIG.Item.documentClass = BladesItemProxy;
Expand Down
86 changes: 70 additions & 16 deletions module/classes/BladesChat.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
// #region IMPORTS ~
import { ApplyTooltipAnimations, ApplyConsequenceAnimations } from "../core/gsap.js";
import { Position, RollResult } from "../core/constants.js";
import BladesConsequence from "./BladesConsequence.js";
class BladesChat extends ChatMessage {
// static override defineSchema() {
Expand All @@ -10,10 +11,12 @@ class BladesChat extends ChatMessage {
// }
static Initialize() {
// let lastMessageID: string|false = Array.from(game.messages).pop()?.id ?? "";
Hooks.on("renderChatMessage", (_msg, html) => {
Hooks.on("renderChatMessage", (msg, html) => {
ApplyTooltipAnimations(html);
ApplyConsequenceAnimations(html);
BladesConsequence.ApplyChatListeners(html);
if (msg.isRollResult) {
ApplyConsequenceAnimations(html);
BladesConsequence.ApplyChatListeners(html);
}
html.addClass("display-ok");
// if (lastMessageID && _msg.id === lastMessageID) {
// setTimeout(() => {
Expand All @@ -36,28 +39,79 @@ class BladesChat extends ChatMessage {
"systems/eunos-blades/templates/chat/roll-result/fortune-incarceration.hbs",
"systems/eunos-blades/templates/chat/roll-result/fortune-engagement.hbs",
"systems/eunos-blades/templates/chat/roll-result/indulgevice.hbs",
"systems/eunos-blades/templates/chat/roll-result/resistance.hbs"
"systems/eunos-blades/templates/chat/roll-result/resistance.hbs",
"systems/eunos-blades/templates/chat/components/die.hbs"
]);
}
static async ConstructRollOutput(rollInst) {
const messageData = {
// Expand rollInst flag data to include results & consequences
const { flagData, finalPosition, finalEffect, rollResult, rollTraitVerb, rollTraitPastVerb, finalDiceData, resultChatTemplate } = rollInst;
const rollFlags = {
template: resultChatTemplate,
...flagData,
finalPosition,
finalEffect,
rollResult,
rollTraitVerb: rollTraitVerb ?? "",
rollTraitPastVerb: rollTraitPastVerb ?? rollTraitVerb ?? "",
finalDiceData
};
return await BladesChat.create({
speaker: rollInst.getSpeaker(BladesChat.getSpeaker()),
content: await rollInst.getResultHTML(""),
content: await renderTemplate(resultChatTemplate, rollFlags),
type: CONST.CHAT_MESSAGE_TYPES.ROLL,
csqData: rollInst.csqData
flags: rollFlags
});
}
get allRollConsequencesData() {
const returnData = {
[Position.controlled]: {
[RollResult.critical]: {},
[RollResult.success]: {},
[RollResult.partial]: {},
[RollResult.fail]: {}
},
[Position.risky]: {
[RollResult.critical]: {},
[RollResult.success]: {},
[RollResult.partial]: {},
[RollResult.fail]: {}
},
[Position.desperate]: {
[RollResult.critical]: {},
[RollResult.success]: {},
[RollResult.partial]: {},
[RollResult.fail]: {}
}
};
const chatMessage = await BladesChat.create(messageData, {});
await chatMessage.update({ content: await rollInst.getResultHTML(chatMessage.id) });
chatMessage.rollInst = rollInst;
return chatMessage;
const { consequenceData } = this.flags;
if (!consequenceData) {
return returnData;
}
Object.entries(consequenceData)
.forEach(([position, positionData]) => {
Object.entries(positionData)
.forEach(([rollResult, csqData]) => {
returnData[position][rollResult] = csqData;
});
});
return returnData;
}
get rollConsequencesData() {
if (!this.isRollResult) {
return [];
}
const { finalPosition, rollResult, consequenceData } = this.flags;
if (typeof rollResult !== "string" || ![RollResult.partial, RollResult.fail].includes(rollResult)) {
return [];
}
const activeConsequences = consequenceData?.[finalPosition]?.[rollResult] ?? {};
return Object.values(activeConsequences);
}
_rollInst;
get rollInst() { return this._rollInst; }
set rollInst(rollInst) { this._rollInst = rollInst; }
get elem() { return $("#chat-log").find(`.chat-message[data-message-id="${this.id}"]`)[0]; }
get isRollResult() { return this.type === CONST.CHAT_MESSAGE_TYPES.ROLL; }
async reRender(html) {
this.update({ content: html });
async regenerateFromFlags() {
await this.update({ content: await renderTemplate(this.flags.template, this.flags) });
}
async render(force) {
await super.render(force);
Expand Down
Loading

0 comments on commit 64a3825

Please sign in to comment.