Skip to content

Commit

Permalink
Clocks & Consequences initialized to Collections. Start on BladesDire…
Browse files Browse the repository at this point in the history
…ctor
  • Loading branch information
Eunomiac committed Dec 13, 2023
1 parent f3c2c8e commit eb81aa9
Show file tree
Hide file tree
Showing 70 changed files with 10,865 additions and 188 deletions.
2,639 changes: 2,639 additions & 0 deletions css/style.min.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions module/BladesActor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import U from "./core/utilities.js";
import C, { BladesActorType, Tag, Playbook, BladesItemType, ActionTrait, PrereqType, AdvancementPoint, Randomizers, Factor } from "./core/constants.js";
import { BladesPC, BladesNPC } from "./documents/BladesActorProxy.js";
import { BladesItem } from "./documents/BladesItemProxy.js";
import { BladesRollMod } from "./BladesRoll.js";
import BladesPushAlert from "./BladesPushAlert.js";
import { SelectionCategory } from "./BladesDialog.js";
import { BladesRollMod } from "./classes/BladesRoll.js";
import BladesPushAlert from "./classes/BladesPushAlert.js";
import { SelectionCategory } from "./classes/BladesDialog.js";
// #endregion
// Blades Theme Song: "Bangkok" from The Gray Man soundtrack: https://www.youtube.com/watch?v=cjjImvMqYlo&list=OLAK5uy_k9cZDd1Fbpd25jfDtte5A6HyauD2-cwgk&index=2
// Also check out Discord thread: https://discord.com/channels/325094888133885952/1152316839163068527
Expand Down
4 changes: 2 additions & 2 deletions module/BladesItem.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import C, { BladesItemType, Tag, Factor } from "./core/constants.js";
import U from "./core/utilities.js";
import { BladesCrew, BladesPC } from "./documents/BladesActorProxy.js";
import { BladesRollMod } from "./BladesRoll.js";
import BladesPushAlert from "./BladesPushAlert.js";
import { BladesRollMod } from "./classes/BladesRoll.js";
import BladesPushAlert from "./classes/BladesPushAlert.js";
class BladesItem extends Item {
// #region Static Overrides: Create ~
static async create(data, options = {}) {
Expand Down
22 changes: 16 additions & 6 deletions module/blades.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,25 @@
import C, { ActionTrait, ClockColor, AttributeTrait, RollType, ConsequenceType } from "./core/constants.js";
import registerSettings, { initTinyMCEStyles, initCanvasStyles, initDOMStyles } from "./core/settings.js";
import { registerHandlebarHelpers, preloadHandlebarsTemplates } from "./core/helpers.js";
import BladesPushAlert from "./BladesPushAlert.js";
import BladesChat from "./BladesChat.js";
import BladesPushAlert from "./classes/BladesPushAlert.js";
import BladesChat from "./classes/BladesChat.js";
import U from "./core/utilities.js";
import logger from "./core/logger.js";
import G, { Initialize as GsapInitialize } from "./core/gsap.js";
import BladesClock, { BladesClockKey } from "./documents/items/BladesClock.js";
import BladesClock, { BladesClockKey } from "./classes/BladesClock.js";
import BladesDirector from "./classes/BladesDirector.js";
import BladesConsequence from "./classes/BladesConsequence.js";
import BladesActorProxy, { BladesActor, BladesPC, BladesCrew, BladesNPC, BladesFaction } from "./documents/BladesActorProxy.js";
import BladesItemProxy, { BladesItem, BladesClockKeeper, BladesGMTracker, BladesLocation, BladesScore, BladesProject } from "./documents/BladesItemProxy.js";
import BladesItemSheet from "./sheets/item/BladesItemSheet.js";
import BladesPCSheet from "./sheets/actor/BladesPCSheet.js";
import BladesCrewSheet from "./sheets/actor/BladesCrewSheet.js";
import BladesNPCSheet from "./sheets/actor/BladesNPCSheet.js";
import BladesFactionSheet from "./sheets/actor/BladesFactionSheet.js";
import BladesRoll, { BladesRollMod, BladesRollPrimary, BladesRollOpposition, BladesRollParticipant } from "./BladesRoll.js";
import BladesDialog from "./BladesDialog.js";
import BladesRoll, { BladesRollMod, BladesRollPrimary, BladesRollOpposition, BladesRollParticipant } from "./classes/BladesRoll.js";
import BladesDialog from "./classes/BladesDialog.js";
import BladesAI, { AGENTS, AIAssistant } from "./core/ai.js";
import BladesActiveEffect from "./BladesActiveEffect.js";
import BladesActiveEffect from "./documents/BladesActiveEffect.js";
import BladesGMTrackerSheet from "./sheets/item/BladesGMTrackerSheet.js";
import BladesClockKeeperSheet from "./sheets/item/BladesClockKeeperSheet.js";
CONFIG.debug.logging = false;
Expand Down Expand Up @@ -527,6 +529,7 @@ class GlobalGetter {
// updateFactions,
// updateDescriptions,
// updateRollMods,
BladesDirector,
BladesActor,
BladesPC,
BladesCrew,
Expand All @@ -546,6 +549,7 @@ class GlobalGetter {
BladesRollOpposition,
BladesRollParticipant,
BladesChat,
BladesConsequence,
G,
U,
C,
Expand Down Expand Up @@ -586,6 +590,7 @@ Hooks.once("init", async () => {
Items.registerSheet("blades", BladesItemSheet, { types: C.ItemTypes, makeDefault: true });
// Initialize subclasses
await Promise.all([
BladesDirector.Initialize(),
BladesPCSheet.Initialize(),
BladesActiveEffect.Initialize(),
BladesGMTrackerSheet.Initialize(),
Expand All @@ -604,12 +609,17 @@ Hooks.once("ready", () => {
initDOMStyles();
initCanvasStyles();
initTinyMCEStyles();
// Initialize Clocks, ClockKeys & Consequences
BladesClockKey.Initialize();
BladesConsequence.Initialize();
BladesDirector.getInstance().renderOverlay();
});
// #endregion ▄▄▄▄▄ SYSTEM INITIALIZATION ▄▄▄▄▄
// #region ░░░░░░░[SocketLib]░░░░ SocketLib Initialization ░░░░░░░ ~
Hooks.once("socketlib.ready", () => {
socket = socketlib.registerSystem("eunos-blades");
/* DEVCODE*/ Object.assign(globalThis, { socket, socketlib }); /* !DEVCODE*/
BladesDirector.InitSockets();
BladesRoll.InitSockets();
let clockOverlayUp;
let pushControllerUp;
Expand Down
45 changes: 45 additions & 0 deletions module/classes/BladesChat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// #region IMPORTS ~
import { ApplyTooltipAnimations, ApplyConsequenceAnimations } from "../core/gsap.js";
import BladesConsequence from "./BladesConsequence.js";
// #endregion
class BladesChat extends ChatMessage {
static Initialize() {
// let lastMessageID: string|false = Array.from(game.messages).pop()?.id ?? "";
Hooks.on("renderChatMessage", (_msg, html) => {
ApplyTooltipAnimations(html);
ApplyConsequenceAnimations(html);
BladesConsequence.ApplyChatListeners(html);
html.addClass("display-ok");
// if (lastMessageID && _msg.id === lastMessageID) {
// setTimeout(() => {
// $(document).find("#chat .chat-message:not([class*='-roll'])")
// .remove();
// }, 500);
// lastMessageID = false;
// }
});
return loadTemplates([
"systems/eunos-blades/templates/chat/roll-result-action-roll.hbs",
"systems/eunos-blades/templates/chat/roll-result-resistance-roll.hbs",
"systems/eunos-blades/templates/chat/roll-result-fortune-roll.hbs",
"systems/eunos-blades/templates/chat/roll-result-indulgevice-roll.hbs"
]);
}
static async ConstructRollOutput(rollInst) {
const messageData = {
speaker: rollInst.getSpeaker(BladesChat.getSpeaker()),
content: await rollInst.getResultHTML("")
};
const chatMessage = await BladesChat.create(messageData, {});
await chatMessage.update({ content: await rollInst.getResultHTML(chatMessage.id) });
chatMessage.rollInst = rollInst;
return chatMessage;
}
_rollInst;
get rollInst() { return this._rollInst; }
set rollInst(rollInst) { this._rollInst = rollInst; }
async reRender(html) {
this.update({ content: html });
}
}
export default BladesChat;
Loading

0 comments on commit eb81aa9

Please sign in to comment.