From b434faead4cb1f76686167c22e3e64626d597993 Mon Sep 17 00:00:00 2001 From: Eunomiac Date: Thu, 5 Oct 2023 17:56:27 -0400 Subject: [PATCH] Reverted to using User as roll storage document --- gulpfile.js | 16 +- module/BladesActiveEffect.js | 4 +- module/BladesActor.js | 4 +- module/BladesDialog.js | 4 +- module/BladesItem.js | 4 +- module/BladesPushController.js | 4 +- module/BladesRollCollab.js | 299 +++------------- module/blades-active-effect.js | 3 +- module/blades-actor.js | 3 +- module/blades-dialog.js | 3 +- module/blades-item.js | 3 +- module/blades-push-notifications.js | 3 +- module/blades-roll-collab.js | 3 +- module/blades-roll.js | 3 +- module/blades.js | 4 +- module/core/ai.js | 4 +- module/core/constants.js | 4 +- module/core/gsap.js | 4 +- module/core/helpers.js | 4 +- module/core/logger.js | 4 +- module/core/mixins.js | 4 +- module/core/settings.js | 4 +- module/core/tags.js | 4 +- module/core/utilities.js | 4 +- module/data-import/data-import.js | 4 +- module/documents/BladesActorProxy.js | 4 +- module/documents/BladesItemProxy.js | 4 +- module/documents/actors/BladesCrew.js | 4 +- module/documents/actors/BladesFaction.js | 4 +- module/documents/actors/BladesNPC.js | 4 +- module/documents/actors/BladesPC.js | 8 +- module/documents/actors/blades-crew.js | 3 +- module/documents/actors/blades-faction.js | 3 +- module/documents/actors/blades-npc.js | 3 +- module/documents/actors/blades-pc.js | 3 +- module/documents/blades-actor-proxy.js | 3 +- module/documents/blades-item-location.js | 3 +- module/documents/blades-item-proxy.js | 3 +- module/documents/items/BladesClockKeeper.js | 4 +- module/documents/items/BladesGMTracker.js | 4 +- module/documents/items/BladesLocation.js | 4 +- module/documents/items/BladesScore.js | 4 +- module/documents/items/blades-clock-keeper.js | 3 +- module/documents/items/blades-gm-tracker.js | 3 +- .../documents/items/blades-item-location.js | 3 +- .../documents/items/blades-location copy.js | 3 +- module/documents/items/blades-location.js | 3 +- module/documents/items/blades-score.js | 3 +- module/sheets/actor/BladesActorSheet.js | 4 +- module/sheets/actor/BladesCrewSheet.js | 4 +- module/sheets/actor/BladesFactionSheet.js | 4 +- module/sheets/actor/BladesNPCSheet.js | 4 +- module/sheets/actor/BladesPCSheet.js | 4 +- module/sheets/actor/blades-actor-sheet.js | 3 +- module/sheets/actor/blades-crew-sheet.js | 3 +- module/sheets/actor/blades-faction-sheet.js | 3 +- module/sheets/actor/blades-npc-sheet.js | 3 +- module/sheets/actor/blades-pc-sheet.js | 3 +- module/sheets/actor/blades-sheet.js | 3 +- module/sheets/blades-actor-sheet.js | 3 +- module/sheets/blades-clock-keeper-sheet.js | 3 +- module/sheets/blades-crew-sheet.js | 3 +- module/sheets/blades-faction-sheet.js | 3 +- module/sheets/blades-item-sheet.js | 3 +- module/sheets/blades-npc-sheet.js | 3 +- module/sheets/blades-roll-collab-sheet.js | 3 +- module/sheets/blades-sheet.js | 3 +- module/sheets/blades-tracker-sheet.js | 3 +- module/sheets/item/BladesClockKeeperSheet.js | 4 +- module/sheets/item/BladesGMTrackerSheet.js | 4 +- module/sheets/item/BladesItemSheet.js | 4 +- module/sheets/item/BladesScoreSheet.js | 4 +- .../sheets/item/blades-clock-keeper-sheet.js | 3 +- module/sheets/item/blades-item-sheet.js | 3 +- module/sheets/item/blades-score-sheet.js | 3 +- .../sheets/item/blades-tracker-sheet copy.js | 3 +- module/sheets/item/blades-tracker-sheet.js | 3 +- .../sheets/roll/blades-roll-collab-sheet.js | 3 +- ts/@types/blades-roll.d.ts | 24 +- ts/BladesRollCollab.ts | 338 +++--------------- ts/documents/actors/BladesPC.ts | 5 +- 81 files changed, 196 insertions(+), 753 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index c925b636..567516f3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -22,7 +22,7 @@ const prefixer = require("autoprefixer"); const minifier = require("cssnano"); const packageJSON = require("./package"); -const sourcemaps = require("gulp-sourcemaps"); +// const sourcemaps = require("gulp-sourcemaps"); const {analyzeProject} = require("codehawk-cli"); // #endregion ▮▮▮▮[IMPORTS]▮▮▮▮ @@ -411,7 +411,7 @@ const PLUMBING = { }, tsInit: (source, destination) => function pipeTypeScript() { const tsStream = src(source, {allowEmpty: true}) - .pipe(sourcemaps.init()) + // .pipe(sourcemaps.init()) .pipe(PIPES.openPipe("tsInit")()) .pipe(PIPES.replacer("init")()) .pipe(PIPES.tsProject()); @@ -419,7 +419,7 @@ const PLUMBING = { return merger([ tsStream.js .pipe(PIPES.replacer("ts")()) - .pipe(sourcemaps.write(".")) + // .pipe(sourcemaps.write(".")) .pipe(PIPES.closePipe("tsInit", source, destination)), tsStream.dts .pipe(PIPES.closePipe("tsInit", source, `${destination}definitions`)) @@ -428,27 +428,27 @@ const PLUMBING = { return tsStream .pipe(PIPES.replacer("ts")()) .pipe(PIPES.replacer("js")()) - .pipe(sourcemaps.write(".")) + // .pipe(sourcemaps.write(".")) .pipe(PIPES.closePipe("tsInit", source, destination)); }, jsFull: (source, destination) => function pipeFullJS() { return src(source, {allowEmpty: true}) - .pipe(sourcemaps.init()) + // .pipe(sourcemaps.init()) .pipe(PIPES.openPipe("jsFull")()) .pipe(header(BANNERS.js.full, {"package": packageJSON})) .pipe(PIPES.replacer("js")()) - .pipe(sourcemaps.write(".")) + // .pipe(sourcemaps.write(".")) .pipe(PIPES.closePipe("jsFull", source, destination)); }, jsMin: (source, destination) => function pipeMinJS() { return src(source, {allowEmpty: true}) - .pipe(sourcemaps.init()) + // .pipe(sourcemaps.init()) .pipe(PIPES.openPipe("jsMin")()) .pipe(header(BANNERS.js.min, {"package": packageJSON})) .pipe(PIPES.replacer("js")()) // .pipe(renamer({suffix: ".min"})) .pipe(PIPES.terser()()) - .pipe(sourcemaps.write(".")) + // .pipe(sourcemaps.write(".")) .pipe(PIPES.closePipe("jsMin", source, destination)); }, cssFull: (source, destination) => function pipeFullCSS() { diff --git a/module/BladesActiveEffect.js b/module/BladesActiveEffect.js index ed4e976d..fe76d5ed 100644 --- a/module/BladesActiveEffect.js +++ b/module/BladesActiveEffect.js @@ -342,6 +342,4 @@ class BladesActiveEffect extends ActiveEffect { return super.isSuppressed || item?.hasTag(Tag.System.Archived); } } -export default BladesActiveEffect; -//# sourceMappingURL=BladesActiveEffect.js.map -//# sourceMappingURL=BladesActiveEffect.js.map +export default BladesActiveEffect; \ No newline at end of file diff --git a/module/BladesActor.js b/module/BladesActor.js index a70047ff..ee055078 100644 --- a/module/BladesActor.js +++ b/module/BladesActor.js @@ -1001,6 +1001,4 @@ class BladesActor extends Actor { this.update(updateData); } } -export default BladesActor; -//# sourceMappingURL=BladesActor.js.map -//# sourceMappingURL=BladesActor.js.map +export default BladesActor; \ No newline at end of file diff --git a/module/BladesDialog.js b/module/BladesDialog.js index 0f72ba44..81c5067c 100644 --- a/module/BladesDialog.js +++ b/module/BladesDialog.js @@ -133,6 +133,4 @@ class BladesSelectorDialog extends Dialog { }); } } -export default BladesSelectorDialog; -//# sourceMappingURL=BladesDialog.js.map -//# sourceMappingURL=BladesDialog.js.map +export default BladesSelectorDialog; \ No newline at end of file diff --git a/module/BladesItem.js b/module/BladesItem.js index 39b23941..35644019 100644 --- a/module/BladesItem.js +++ b/module/BladesItem.js @@ -291,6 +291,4 @@ class BladesItem extends Item { } } } -export default BladesItem; -//# sourceMappingURL=BladesItem.js.map -//# sourceMappingURL=BladesItem.js.map +export default BladesItem; \ No newline at end of file diff --git a/module/BladesPushController.js b/module/BladesPushController.js index 2eda59d8..f7f5c728 100644 --- a/module/BladesPushController.js +++ b/module/BladesPushController.js @@ -91,6 +91,4 @@ export default class BladesPushController { pushToGM(...args) { socketlib.system.executeForAllGMs("pushNotice", "to-gm-notice", ...args); } -} -//# sourceMappingURL=BladesPushController.js.map -//# sourceMappingURL=BladesPushController.js.map +} \ No newline at end of file diff --git a/module/BladesRollCollab.js b/module/BladesRollCollab.js index 6a86e0dd..a9c82e22 100644 --- a/module/BladesRollCollab.js +++ b/module/BladesRollCollab.js @@ -761,7 +761,6 @@ class BladesRollParticipant { } } } - class BladesRollCollab extends DocumentSheet { static get defaultOptions() { @@ -983,8 +982,9 @@ class BladesRollCollab extends DocumentSheet { static set Active(val) { BladesRollCollab._Active = val; } - static async RenderRollCollab({ storageID, rollID, rollPermission }) { - const rollInst = new BladesRollCollab(storageID, rollID, rollPermission); + static async RenderRollCollab({ userID, rollID, rollPermission }) { + const rollInst = new BladesRollCollab(userID, rollID, rollPermission); + eLog.checkLog3("rollCollab", "RenderRollCollab()", { params: { userID, rollID, rollPermission }, rollInst }); await rollInst._render(true); } static async CloseRollCollab(rollID) { @@ -996,28 +996,15 @@ class BladesRollCollab extends DocumentSheet { if (!isRollType(config.rollType)) { throw new Error("[BladesRollCollab.NewRoll()] You must provide a valid rollType in the config object."); } - if (!config.rollStorageID) { - if (config.rollPrimaryData instanceof BladesActor || config.rollPrimaryData instanceof BladesItem) { - config.rollStorageID = config.rollPrimaryData.id; - } - else if (typeof config.rollPrimaryData?.rollPrimaryID === "string") { - config.rollStorageID = config.rollPrimaryData.rollPrimaryID; - } - else if (!game.user.isGM && game.user instanceof User && BladesRollPrimary.IsDoc(game.user.character)) { - config.rollStorageID = game.user.character.id; - } - } - const rollStorageDoc = game.actors.get(config.rollStorageID ?? "") ?? game.items.get(config.rollStorageID ?? "") ?? false; - if (!rollStorageDoc) { - throw new Error("[BladesRollCollab.NewRoll()] A valid rollStorage document must be provided to construct a roll."); + config.rollUserID ??= game.user.id ?? undefined; + const rollUser = game.users.get(config.rollUserID ?? ""); + if (!rollUser) { + throw new Error("[BladesRollCollab.NewRoll()] You must provide a valid rollUserID in the config object."); } if (!BladesRollPrimary.IsValidData(config.rollPrimaryData)) { let rollPrimarySourceData; - if (!game.user.isGM && BladesPC.IsType(game.user.character)) { - rollPrimarySourceData = game.user.character; - } - else if (BladesRollPrimary.IsDoc(rollStorageDoc)) { - rollPrimarySourceData = rollStorageDoc; + if (BladesPC.IsType(rollUser.character)) { + rollPrimarySourceData = rollUser.character; } else { throw new Error("[BladesRollCollab.NewRoll()] A valid source of PrimaryDocData must be provided to construct a roll."); @@ -1037,7 +1024,6 @@ class BladesRollCollab extends DocumentSheet { const flagUpdateData = { ...BladesRollCollab.DefaultFlagData, rollID, - storageDocID: rollStorageDoc.id, rollType: config.rollType, rollPrimaryData: config.rollPrimaryData }; @@ -1081,15 +1067,7 @@ class BladesRollCollab extends DocumentSheet { } } eLog.checkLog3("bladesRoll", "BladesRollCollab.NewRoll()", { flagUpdateData, rollPrimaryData: flagUpdateData.rollPrimaryData }); - if (rollStorageDoc instanceof BladesActor) { - await rollStorageDoc.setFlag(C.SYSTEM_ID, `rollCollab.${flagUpdateData.rollID}`, flagUpdateData); - } - else if (rollStorageDoc instanceof BladesItem) { - await rollStorageDoc.setFlag(C.SYSTEM_ID, `rollCollab.${flagUpdateData.rollID}`, flagUpdateData); - } - else { - throw new Error("rollStorageDoc must be an instance of Actor or Item"); - } + await rollUser.setFlag(C.SYSTEM_ID, "rollCollab", flagUpdateData); const userIDs = { primary: [], participants: [], @@ -1147,28 +1125,26 @@ class BladesRollCollab extends DocumentSheet { userIDs.participants.push(...participantUsers); userIDs.observers = userIDs.observers.filter((uID) => !userIDs.participants.includes(uID)); } - socketlib.system.executeForAllGMs("renderRollCollab", { storageID: rollStorageDoc.id, rollID, rollPermission: RollPermissions.GM }); - socketlib.system.executeForUsers("renderRollCollab", userIDs.primary, { storageID: rollStorageDoc.id, rollID, rollPermission: RollPermissions.Primary }); - socketlib.system.executeForUsers("renderRollCollab", userIDs.participants, { storageID: rollStorageDoc.id, rollID, rollPermission: RollPermissions.Participant }); - socketlib.system.executeForUsers("renderRollCollab", userIDs.observers, { storageID: rollStorageDoc.id, rollID, rollPermission: RollPermissions.Observer }); + socketlib.system.executeForAllGMs("renderRollCollab", { userID: rollUser.id, rollID, rollPermission: RollPermissions.GM }); + socketlib.system.executeForUsers("renderRollCollab", userIDs.primary, { userID: rollUser.id, rollID, rollPermission: RollPermissions.Primary }); + socketlib.system.executeForUsers("renderRollCollab", userIDs.participants, { userID: rollUser.id, rollID, rollPermission: RollPermissions.Participant }); + socketlib.system.executeForUsers("renderRollCollab", userIDs.observers, { userID: rollUser.id, rollID, rollPermission: RollPermissions.Observer }); } - storageID; rollID; rollPermission; _rollPrimary; _rollOpposition; _rollParticipants; - constructor(storageID, rollID, rollPermission) { - const storageDoc = game.actors.get(storageID) ?? game.items.get(storageID); - if (!storageDoc) { - throw new Error(`Unable to retrieve storage document with ID '${storageID}'`); + constructor(userID, rollID, rollPermission) { + const rollUser = game.users.get(userID); + if (!rollUser) { + throw new Error("[new BladesRollCollab()] Must provide a valid rollUser to roll."); } - super(storageDoc); - this.storageID = storageID; + super(rollUser); this.rollID = rollID; this.rollPermission = rollPermission; - const rollFlagData = storageDoc.getFlag(C.SYSTEM_ID, `rollCollab.${rollID}`); + const rollFlagData = rollUser.getFlag(C.SYSTEM_ID, "rollCollab"); this._rollPrimary = new BladesRollPrimary(this, rollFlagData.rollPrimaryData); if (rollFlagData.rollOppData) { this._rollOpposition = new BladesRollOpposition(this, rollFlagData.rollOppData); @@ -1189,14 +1165,23 @@ class BladesRollCollab extends DocumentSheet { } get flagData() { - if (!this.document.getFlag(C.SYSTEM_ID, `rollCollab.${this.rollID}`)) { - throw new Error("[get flags()] No RollCollab Flags Found on Storage Document"); + if (!this.document.getFlag(C.SYSTEM_ID, "rollCollab")) { + throw new Error("[get flags()] No RollCollab Flags Found on User Document"); } - return this.document.getFlag(C.SYSTEM_ID, `rollCollab.${this.rollID}`); + return this.document.getFlag(C.SYSTEM_ID, "rollCollab"); } get rollPrimary() { return this._rollPrimary; } + get rollPrimaryDoc() { + if (BladesRollPrimary.IsDoc(this.rollPrimary.rollPrimaryDoc)) { + return this.rollPrimary.rollPrimaryDoc; + } + if (BladesRollPrimary.IsDoc(this.rollPrimary)) { + return this.rollPrimary; + } + return undefined; + } get rollOpposition() { if (this._rollOpposition instanceof BladesRollOpposition) { return this._rollOpposition; @@ -1223,26 +1208,22 @@ class BladesRollCollab extends DocumentSheet { get rollTraitValOverride() { return this._rollTraitValOverride; } set rollTraitValOverride(val) { this._rollTraitValOverride = val; } get rollTraitData() { - const { rollPrimaryDoc } = this.rollPrimary ?? {}; - if (!BladesRollPrimary.IsDoc(rollPrimaryDoc)) { - throw new Error("[get rollTraitData()] Missing Roll Primary!"); - } - if (BladesActor.IsType(rollPrimaryDoc, BladesActorType.pc)) { + if (BladesActor.IsType(this.rollPrimaryDoc, BladesActorType.pc)) { if (isAction(this.rollTrait)) { return { name: this.rollTrait, - value: this.rollTraitValOverride ?? rollPrimaryDoc.actions[this.rollTrait], - max: this.rollTraitValOverride ?? rollPrimaryDoc.actions[this.rollTrait], - pcTooltip: rollPrimaryDoc.rollTraitPCTooltipActions, + value: this.rollTraitValOverride ?? this.rollPrimaryDoc.actions[this.rollTrait], + max: this.rollTraitValOverride ?? this.rollPrimaryDoc.actions[this.rollTrait], + pcTooltip: this.rollPrimaryDoc.rollTraitPCTooltipActions, gmTooltip: C.ActionTooltipsGM[this.rollTrait] }; } if (isAttribute(this.rollTrait)) { return { name: this.rollTrait, - value: this.rollTraitValOverride ?? rollPrimaryDoc.attributes[this.rollTrait], - max: this.rollTraitValOverride ?? rollPrimaryDoc.attributes[this.rollTrait], - pcTooltip: rollPrimaryDoc.rollTraitPCTooltipAttributes, + value: this.rollTraitValOverride ?? this.rollPrimaryDoc.attributes[this.rollTrait], + max: this.rollTraitValOverride ?? this.rollPrimaryDoc.attributes[this.rollTrait], + pcTooltip: this.rollPrimaryDoc.rollTraitPCTooltipAttributes, gmTooltip: C.AttributeTooltips[this.rollTrait] }; } @@ -1257,14 +1238,14 @@ class BladesRollCollab extends DocumentSheet { if (isFactor(this.rollTrait)) { return { name: U.tCase(this.rollTrait), - value: this.rollTraitValOverride ?? this.rollPrimary?.rollFactors[this.rollTrait]?.value ?? 0, - max: this.rollTraitValOverride ?? this.rollPrimary?.rollFactors[this.rollTrait]?.max ?? 10 + value: this.rollTraitValOverride ?? this.rollPrimary.rollFactors[this.rollTrait]?.value ?? 0, + max: this.rollTraitValOverride ?? this.rollPrimary.rollFactors[this.rollTrait]?.max ?? 10 }; } throw new Error(`[get rollTraitData] Invalid rollTrait: '${this.rollTrait}'`); } get rollTraitOptions() { - if (BladesActor.IsType(this.rollPrimary, BladesActorType.pc)) { + if (BladesActor.IsType(this.rollPrimaryDoc, BladesActorType.pc)) { if (isAction(this.rollTrait)) { return Object.values(ActionTrait) .map((action) => ({ @@ -1348,7 +1329,7 @@ class BladesRollCollab extends DocumentSheet { return this._roll; } get rollFactors() { - const sourceFactors = Object.fromEntries(Object.entries(this.rollPrimary?.rollFactors ?? {}) + const sourceFactors = Object.fromEntries(Object.entries(this.rollPrimary.rollFactors) .map(([factor, factorData]) => [ factor, { @@ -1473,9 +1454,8 @@ class BladesRollCollab extends DocumentSheet { while (holdKeys.length) { const thisTarget = holdKeys.pop()?.split(/-/)?.pop(); if (thisTarget === "BestAction") { - const { rollPrimaryDoc } = this.rollPrimary ?? {}; - if (BladesActor.IsType(rollPrimaryDoc, BladesActorType.pc)) { - this.rollTraitValOverride = Math.max(...Object.values(rollPrimaryDoc.actions)); + if (BladesPC.IsType(this.rollPrimaryDoc)) { + this.rollTraitValOverride = Math.max(...Object.values(this.rollPrimaryDoc.actions)); } } else { @@ -1686,9 +1666,6 @@ class BladesRollCollab extends DocumentSheet { async getData() { const context = super.getData(); - if (!this.rollPrimary) { - throw new Error("No roll source configured for roll."); - } this.initRollMods(this.getRollModsData()); this.rollMods.forEach((rollMod) => rollMod.applyRollModEffectKeys()); const sheetData = this.getSheetData(this.getIsGM(), this.getRollCosts()); @@ -1697,7 +1674,7 @@ class BladesRollCollab extends DocumentSheet { getRollModsData() { const defaultMods = [ ...BladesRollCollab.DefaultRollMods, - ...this.rollPrimary?.rollModsData ?? [] + ...this.rollPrimary.rollModsData ]; if (this.rollOpposition?.rollOppModsData) { return [ @@ -1735,7 +1712,7 @@ class BladesRollCollab extends DocumentSheet { cssClass: "roll-collab", editable: this.options.editable, isGM, - system: this.rollPrimary?.rollPrimaryDoc?.system, + system: this.rollPrimaryDoc?.system, rollMods, rollPrimary, rollTraitData, @@ -1762,6 +1739,7 @@ class BladesRollCollab extends DocumentSheet { const positionEffectTradeData = this.calculatePositionEffectTradeData(); return { ...baseData, + ...(this.rollPrimary.rollPrimaryDoc ? { rollPrimary: this.rollPrimary.rollPrimaryDoc } : {}), ...rollPositionData, ...rollEffectData, ...rollResultData, @@ -1809,7 +1787,6 @@ class BladesRollCollab extends DocumentSheet { } }; } - calculateOddsGradient(diceTotal, finalResult) { const oddsColors = { crit: "var(--blades-cyan)", @@ -1885,179 +1862,7 @@ class BladesRollCollab extends DocumentSheet { } return undefined; } - async OLDgetData() { - const context = super.getData(); - const rData = this.flagData; - if (!this.rollPrimary) { - throw new Error("No roll source configured for roll."); - } - const rollModsData = [ - ...BladesRollCollab.DefaultRollMods, - ...this.rollPrimary.rollModsData ?? [] - ]; - if (this.rollOpposition?.rollOppModsData) { - rollModsData.push(...this.rollOpposition.rollOppModsData); - } - this.initRollMods(rollModsData); - this.rollMods.forEach((rollMod) => rollMod.applyRollModEffectKeys()); - const isGM = game.eunoblades.Tracker?.system.is_spoofing_player ? false : game.user.isGM; - const { rollPrimary, rollOpposition, rollTraitData, rollTraitOptions, finalPosition, finalEffect, finalResult, rollMods, posEffectTrade, rollFactors } = this; - const rollCosts = this.getActiveRollMods() - .map((rollMod) => rollMod.costs) - .flat() - .filter((costData) => costData !== undefined); - const stressCosts = rollCosts.filter((costData) => costData.costType === "Stress"); - const specArmorCost = rollCosts.find((costData) => costData.costType === "SpecialArmor"); - const totalStressCost = U.sum(stressCosts.map((costData) => costData.costAmount)); - const sheetData = { - ...rData, - cssClass: "roll-collab", - editable: this.options.editable, - isGM, - system: this.rollPrimary.rollPrimaryDoc?.system, - rollMods, - rollPrimary, - rollTraitData, - rollTraitOptions, - diceTotal: this.finalDicePool, - rollOpposition, - rollPositions: Object.values(Position), - rollEffects: Object.values(Effect), - teamworkDocs: game.actors.filter((actor) => BladesActor.IsType(actor, BladesActorType.pc)), - rollPositionFinal: finalPosition, - rollEffectFinal: finalEffect, - rollResultFinal: finalResult, - isAffectingResult: finalResult > 0 - || this.getVisibleRollMods(RollModSection.result).length > 0 - || (isGM && this.getRollMods(RollModSection.result).length > 0), - isAffectingAfter: this.getVisibleRollMods(RollModSection.after).length > 0 - || (isGM && this.getRollMods(RollModSection.after).length > 0), - rollFactorPenaltiesNegated: this.rollFactorPenaltiesNegated, - GMBoosts: { - Dice: this.flagData.GMBoosts.Dice ?? 0, - [Factor.tier]: this.flagData.GMBoosts[Factor.tier] ?? 0, - [Factor.quality]: this.flagData.GMBoosts[Factor.quality] ?? 0, - [Factor.scale]: this.flagData.GMBoosts[Factor.scale] ?? 0, - [Factor.magnitude]: this.flagData.GMBoosts[Factor.magnitude] ?? 0, - Result: this.flagData.GMBoosts.Result ?? 0 - }, - GMOppBoosts: { - [Factor.tier]: this.flagData.GMOppBoosts[Factor.tier] ?? 0, - [Factor.quality]: this.flagData.GMOppBoosts[Factor.quality] ?? 0, - [Factor.scale]: this.flagData.GMOppBoosts[Factor.scale] ?? 0, - [Factor.magnitude]: this.flagData.GMOppBoosts[Factor.magnitude] ?? 0 - }, - canTradePosition: posEffectTrade === "position" - || (posEffectTrade === false - && finalPosition !== Position.desperate - && finalEffect !== Effect.extreme), - canTradeEffect: posEffectTrade === "effect" - || (posEffectTrade === false - && finalPosition !== Position.controlled - && finalEffect !== Effect.zero), - posRollMods: Object.fromEntries(Object.values(RollModSection) - .map((cat) => [cat, this.getRollMods(cat, "positive")])), - negRollMods: Object.fromEntries(Object.values(RollModSection) - .map((cat) => [cat, this.getRollMods(cat, "negative")])), - hasInactiveConditionals: { - [RollModSection.roll]: this.getRollMods(RollModSection.roll) - .filter((mod) => mod.isInInactiveBlock) - .length > 0, - [RollModSection.position]: this.getRollMods(RollModSection.position) - .filter((mod) => mod.isInInactiveBlock) - .length > 0, - [RollModSection.effect]: this.getRollMods(RollModSection.effect) - .filter((mod) => mod.isInInactiveBlock) - .length > 0, - [RollModSection.result]: this.getRollMods(RollModSection.result) - .filter((mod) => mod.isInInactiveBlock) - .length > 0, - [RollModSection.after]: this.getRollMods(RollModSection.after) - .filter((mod) => mod.isInInactiveBlock) - .length > 0 - }, - rollFactors, - oddsGradient: "" - }; - if (specArmorCost || totalStressCost) { - sheetData.costData = { - footerLabel: [ - "( Roll Costs", - totalStressCost > 0 - ? `${totalStressCost} Stress` - : null, - specArmorCost && totalStressCost - ? "and" - : null, - specArmorCost - ? "your Special Armor" - : null, - ")" - ] - .filter((line) => Boolean(line)) - .join(" "), - tooltip: [ - "

Roll Costs

" - ] - .filter((line) => Boolean(line)) - .join("") - }; - } - const oddsColors = { - crit: "var(--blades-cyan)", - success: "var(--blades-gold)", - partial: "var(--blades-grey-bright)", - fail: "var(--blades-black-dark)" - }; - const odds = { ...C.DiceOdds[sheetData.diceTotal ?? 0] }; - if ((sheetData.rollResultFinal ?? 0) < 0) { - for (let i = sheetData.rollResultFinal ?? 0; i < 0; i++) { - oddsColors.crit = oddsColors.success; - oddsColors.success = oddsColors.partial; - oddsColors.partial = oddsColors.fail; - } - } - else if ((sheetData.rollResultFinal ?? 0) > 0) { - for (let i = 0; i < (sheetData.rollResultFinal ?? 0); i++) { - oddsColors.fail = oddsColors.partial; - oddsColors.partial = oddsColors.success; - oddsColors.success = oddsColors.crit; - } - } - const gradientStops = { - fail: odds.fail, - partial: odds.fail + odds.partial, - success: odds.fail + odds.partial + odds.success - }; - gradientStops.fail = Math.min(100, Math.max(0, Math.max(gradientStops.fail / 2, gradientStops.fail - 10))); - const critSpan = 100 - gradientStops.success; - gradientStops.success = Math.min(100, Math.max(0, gradientStops.success - Math.max(critSpan / 2, critSpan - 10))); - sheetData.oddsGradient = [ - "linear-gradient(to right", - `${oddsColors.fail} ${gradientStops.fail}%`, - `${oddsColors.partial} ${gradientStops.partial}%`, - `${oddsColors.success} ${gradientStops.success}%`, - `${oddsColors.crit})` - ].join(", "); - sheetData.oddsGradientTestHTML = [ - "
", - `
`, - `
`, - `
`, - `
`, - "
" - ].join(""); - return { - ...context, - ...sheetData - }; - } - + _dieVals; get dieVals() { this._dieVals ??= this.roll.terms[0].results @@ -2122,7 +1927,7 @@ class BladesRollCollab extends DocumentSheet { switch (this.rollType) { case RollType.Action: { renderedHTML = await renderTemplate("systems/eunos-blades/templates/chat/action-roll.hbs", { - sourceName: this.rollPrimary?.rollPrimaryName ?? "", + sourceName: this.rollPrimary.rollPrimaryName, oppName: this.rollOpposition?.rollOppName, type: U.lCase(this.rollType), subType: U.lCase(this.rollSubType), @@ -2440,6 +2245,4 @@ export const BladesRollCollabComps = { Opposition: BladesRollOpposition, Participant: BladesRollParticipant }; -export default BladesRollCollab; -//# sourceMappingURL=BladesRollCollab.js.map -//# sourceMappingURL=BladesRollCollab.js.map +export default BladesRollCollab; \ No newline at end of file diff --git a/module/blades-active-effect.js b/module/blades-active-effect.js index a4d000a7..870fad9e 100644 --- a/module/blades-active-effect.js +++ b/module/blades-active-effect.js @@ -343,5 +343,4 @@ class BladesActiveEffect extends ActiveEffect { } } export default BladesActiveEffect; -//# sourceMappingURL=blades-active-effect.js.map -//# sourceMappingURL=blades-active-effect.js.map +//# sourceMappingURL=blades-active-effect.js.map \ No newline at end of file diff --git a/module/blades-actor.js b/module/blades-actor.js index 76bc6420..3ad16a62 100644 --- a/module/blades-actor.js +++ b/module/blades-actor.js @@ -1001,5 +1001,4 @@ class BladesActor extends Actor { } } export default BladesActor; -//# sourceMappingURL=blades-actor.js.map -//# sourceMappingURL=blades-actor.js.map +//# sourceMappingURL=blades-actor.js.map \ No newline at end of file diff --git a/module/blades-dialog.js b/module/blades-dialog.js index 84e483e1..5fc9adc4 100644 --- a/module/blades-dialog.js +++ b/module/blades-dialog.js @@ -134,5 +134,4 @@ class BladesSelectorDialog extends Dialog { } } export default BladesSelectorDialog; -//# sourceMappingURL=blades-dialog.js.map -//# sourceMappingURL=blades-dialog.js.map +//# sourceMappingURL=blades-dialog.js.map \ No newline at end of file diff --git a/module/blades-item.js b/module/blades-item.js index 03729402..bcdf7326 100644 --- a/module/blades-item.js +++ b/module/blades-item.js @@ -292,5 +292,4 @@ class BladesItem extends Item { } } export default BladesItem; -//# sourceMappingURL=blades-item.js.map -//# sourceMappingURL=blades-item.js.map +//# sourceMappingURL=blades-item.js.map \ No newline at end of file diff --git a/module/blades-push-notifications.js b/module/blades-push-notifications.js index 4d280979..9af8bcc6 100644 --- a/module/blades-push-notifications.js +++ b/module/blades-push-notifications.js @@ -92,5 +92,4 @@ export default class BladesPushController { socketlib.system.executeForAllGMs("pushNotice", "to-gm-notice", ...args); } } -//# sourceMappingURL=blades-push-notifications.js.map -//# sourceMappingURL=blades-push-notifications.js.map +//# sourceMappingURL=blades-push-notifications.js.map \ No newline at end of file diff --git a/module/blades-roll-collab.js b/module/blades-roll-collab.js index f8c5d01e..a2db444e 100644 --- a/module/blades-roll-collab.js +++ b/module/blades-roll-collab.js @@ -3340,5 +3340,4 @@ export const BladesRollCollabComps = { Participant: BladesRollParticipant }; export default BladesRollCollab; -//# sourceMappingURL=blades-roll-collab.js.map -//# sourceMappingURL=blades-roll-collab.js.map +//# sourceMappingURL=blades-roll-collab.js.map \ No newline at end of file diff --git a/module/blades-roll.js b/module/blades-roll.js index 1a0c458c..bdbc8c49 100644 --- a/module/blades-roll.js +++ b/module/blades-roll.js @@ -167,5 +167,4 @@ export async function simpleRollPopup() { "default": "yes" }).render(true); } -//# sourceMappingURL=blades-roll.js.map -//# sourceMappingURL=blades-roll.js.map +//# sourceMappingURL=blades-roll.js.map \ No newline at end of file diff --git a/module/blades.js b/module/blades.js index 805614ee..3fa74851 100644 --- a/module/blades.js +++ b/module/blades.js @@ -115,6 +115,4 @@ Hooks.once("diceSoNiceReady", (dice3d) => { emissiveMaps: [undefined, undefined, undefined, undefined, undefined, "systems/eunos-blades/assets/dice/emission-maps/6.webp"], emissive: "#d89300" }); -}); -//# sourceMappingURL=blades.js.map -//# sourceMappingURL=blades.js.map +}); \ No newline at end of file diff --git a/module/core/ai.js b/module/core/ai.js index 001d5211..94652f62 100644 --- a/module/core/ai.js +++ b/module/core/ai.js @@ -27,6 +27,4 @@ const AI = { } } }; -export default AI; -//# sourceMappingURL=ai.js.map -//# sourceMappingURL=ai.js.map +export default AI; \ No newline at end of file diff --git a/module/core/constants.js b/module/core/constants.js index 7a9920a8..61739819 100644 --- a/module/core/constants.js +++ b/module/core/constants.js @@ -4258,6 +4258,4 @@ export const SVGDATA = { } } }; -export default C; -//# sourceMappingURL=constants.js.map -//# sourceMappingURL=constants.js.map +export default C; \ No newline at end of file diff --git a/module/core/gsap.js b/module/core/gsap.js index 476a04e0..ced74b39 100644 --- a/module/core/gsap.js +++ b/module/core/gsap.js @@ -179,6 +179,4 @@ export function ApplyTooltipListeners(html) { }); }); } -export default U.gsap; -//# sourceMappingURL=gsap.js.map -//# sourceMappingURL=gsap.js.map +export default U.gsap; \ No newline at end of file diff --git a/module/core/helpers.js b/module/core/helpers.js index 4a0701a1..1c5048d7 100644 --- a/module/core/helpers.js +++ b/module/core/helpers.js @@ -283,6 +283,4 @@ handlebarHelpers.eLog5 = function (...args) { handlebarHelpers.eLog(...[5, ...ar Object.assign(handlebarHelpers); export function registerHandlebarHelpers() { Object.entries(handlebarHelpers).forEach(([name, func]) => Handlebars.registerHelper(name, func)); -} -//# sourceMappingURL=helpers.js.map -//# sourceMappingURL=helpers.js.map +} \ No newline at end of file diff --git a/module/core/logger.js b/module/core/logger.js index 62413413..f9cf021f 100644 --- a/module/core/logger.js +++ b/module/core/logger.js @@ -177,6 +177,4 @@ const logger = { error: (...content) => eLogger("error", ...content), hbsLog: (...content) => eLogger("handlebars", ...content) }; -export default logger; -//# sourceMappingURL=logger.js.map -//# sourceMappingURL=logger.js.map +export default logger; \ No newline at end of file diff --git a/module/core/mixins.js b/module/core/mixins.js index 5911f1f5..8ccceaa9 100644 --- a/module/core/mixins.js +++ b/module/core/mixins.js @@ -23,6 +23,4 @@ export const HasPlaybook = (superclass) => class extends superclass { return this.activeSubItems.find((item) => BladesItem.IsType(item, BladesItemType.playbook, BladesItemType.crew_playbook)); } }; -export default MIX; -//# sourceMappingURL=mixins.js.map -//# sourceMappingURL=mixins.js.map +export default MIX; \ No newline at end of file diff --git a/module/core/settings.js b/module/core/settings.js index 7188dc86..dc15dfe2 100644 --- a/module/core/settings.js +++ b/module/core/settings.js @@ -154,6 +154,4 @@ export function initCanvasStyles() { wordWrapWidth: 0.1 }); } -export default registerSettings; -//# sourceMappingURL=settings.js.map -//# sourceMappingURL=settings.js.map +export default registerSettings; \ No newline at end of file diff --git a/module/core/tags.js b/module/core/tags.js index d018c6f3..e614fb77 100644 --- a/module/core/tags.js +++ b/module/core/tags.js @@ -107,6 +107,4 @@ const Tags = { $(html).find(".tags-faction").each((_, e) => makeTagInput(e, factionTags)); } }; -export default Tags; -//# sourceMappingURL=tags.js.map -//# sourceMappingURL=tags.js.map +export default Tags; \ No newline at end of file diff --git a/module/core/utilities.js b/module/core/utilities.js index 8616eb8c..2cb6704d 100644 --- a/module/core/utilities.js +++ b/module/core/utilities.js @@ -1237,6 +1237,4 @@ export default { escapeHTML, sleep, isDocID, loc, getSetting, getTemplatePath, displayImageSelector -}; -//# sourceMappingURL=utilities.js.map -//# sourceMappingURL=utilities.js.map +}; \ No newline at end of file diff --git a/module/data-import/data-import.js b/module/data-import/data-import.js index b6e41e3a..6054ec4f 100644 --- a/module/data-import/data-import.js +++ b/module/data-import/data-import.js @@ -3515,6 +3515,4 @@ export const updateDescriptions = async () => { } return itemDoc.update({ "system.notes": desc }); })); -}; -//# sourceMappingURL=data-import.js.map -//# sourceMappingURL=data-import.js.map +}; \ No newline at end of file diff --git a/module/documents/BladesActorProxy.js b/module/documents/BladesActorProxy.js index 974a743d..654e0ff4 100644 --- a/module/documents/BladesActorProxy.js +++ b/module/documents/BladesActorProxy.js @@ -54,6 +54,4 @@ const BladesActorProxy = new Proxy(function () { }, { } }); export default BladesActorProxy; -export { BladesActor, BladesPC, BladesCrew, BladesNPC, BladesFaction }; -//# sourceMappingURL=BladesActorProxy.js.map -//# sourceMappingURL=BladesActorProxy.js.map +export { BladesActor, BladesPC, BladesCrew, BladesNPC, BladesFaction }; \ No newline at end of file diff --git a/module/documents/BladesItemProxy.js b/module/documents/BladesItemProxy.js index 2980ae49..28fb31bb 100644 --- a/module/documents/BladesItemProxy.js +++ b/module/documents/BladesItemProxy.js @@ -54,6 +54,4 @@ const BladesItemProxy = new Proxy(function () { }, { } }); export default BladesItemProxy; -export { BladesItem, BladesClockKeeper, BladesGMTracker, BladesLocation, BladesScore }; -//# sourceMappingURL=BladesItemProxy.js.map -//# sourceMappingURL=BladesItemProxy.js.map +export { BladesItem, BladesClockKeeper, BladesGMTracker, BladesLocation, BladesScore }; \ No newline at end of file diff --git a/module/documents/actors/BladesCrew.js b/module/documents/actors/BladesCrew.js index 630ae209..3b53febc 100644 --- a/module/documents/actors/BladesCrew.js +++ b/module/documents/actors/BladesCrew.js @@ -80,6 +80,4 @@ class BladesCrew extends BladesActor { return this.activeSubItems.find((item) => item.type === BladesItemType.crew_playbook); } } -export default BladesCrew; -//# sourceMappingURL=BladesCrew.js.map -//# sourceMappingURL=BladesCrew.js.map +export default BladesCrew; \ No newline at end of file diff --git a/module/documents/actors/BladesFaction.js b/module/documents/actors/BladesFaction.js index 9c70ac9d..2f9fca12 100644 --- a/module/documents/actors/BladesFaction.js +++ b/module/documents/actors/BladesFaction.js @@ -58,6 +58,4 @@ class BladesFaction extends BladesActor { return this.update({ [`system.clocks.-=${clockID}`]: null }); } } -export default BladesFaction; -//# sourceMappingURL=BladesFaction.js.map -//# sourceMappingURL=BladesFaction.js.map +export default BladesFaction; \ No newline at end of file diff --git a/module/documents/actors/BladesNPC.js b/module/documents/actors/BladesNPC.js index fc675532..3728c477 100644 --- a/module/documents/actors/BladesNPC.js +++ b/module/documents/actors/BladesNPC.js @@ -72,6 +72,4 @@ class BladesNPC extends BladesActor { get rollParticipantType() { return this.type; } get rollParticipantModsData() { return []; } } -export default BladesNPC; -//# sourceMappingURL=BladesNPC.js.map -//# sourceMappingURL=BladesNPC.js.map +export default BladesNPC; \ No newline at end of file diff --git a/module/documents/actors/BladesPC.js b/module/documents/actors/BladesPC.js index e064a7eb..e3ca2c21 100644 --- a/module/documents/actors/BladesPC.js +++ b/module/documents/actors/BladesPC.js @@ -5,10 +5,10 @@ |* ▌██████████████████░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░███████████████████▐ *| \* ****▌███████████████████████████████████████████████████████████████████████████▐**** */ -import BladesItem from "../../BladesItem.js"; import C, { AttributeTrait, Harm, BladesActorType, BladesItemType, Tag, RollModSection, Factor, RollModStatus } from "../../core/constants.js"; import U from "../../core/utilities.js"; -import BladesActor from "../../BladesActor.js"; +import { BladesActor } from "../BladesActorProxy.js"; +import { BladesItem } from "../BladesItemProxy.js"; import { BladesRollMod } from "../../BladesRollCollab.js"; class BladesPC extends BladesActor { @@ -305,6 +305,4 @@ class BladesPC extends BladesActor { return tooltipStrings.join(""); } } -export default BladesPC; -//# sourceMappingURL=BladesPC.js.map -//# sourceMappingURL=BladesPC.js.map +export default BladesPC; \ No newline at end of file diff --git a/module/documents/actors/blades-crew.js b/module/documents/actors/blades-crew.js index ec72dd55..4d5c1232 100644 --- a/module/documents/actors/blades-crew.js +++ b/module/documents/actors/blades-crew.js @@ -81,5 +81,4 @@ class BladesCrew extends BladesActor { } } export default BladesCrew; -//# sourceMappingURL=blades-crew.js.map -//# sourceMappingURL=blades-crew.js.map +//# sourceMappingURL=blades-crew.js.map \ No newline at end of file diff --git a/module/documents/actors/blades-faction.js b/module/documents/actors/blades-faction.js index 0db53390..12c7ef4d 100644 --- a/module/documents/actors/blades-faction.js +++ b/module/documents/actors/blades-faction.js @@ -59,5 +59,4 @@ class BladesFaction extends BladesActor { } } export default BladesFaction; -//# sourceMappingURL=blades-faction.js.map -//# sourceMappingURL=blades-faction.js.map +//# sourceMappingURL=blades-faction.js.map \ No newline at end of file diff --git a/module/documents/actors/blades-npc.js b/module/documents/actors/blades-npc.js index 3f2d826c..53e26f1e 100644 --- a/module/documents/actors/blades-npc.js +++ b/module/documents/actors/blades-npc.js @@ -73,5 +73,4 @@ class BladesNPC extends BladesActor { get rollParticipantModsData() { return []; } } export default BladesNPC; -//# sourceMappingURL=blades-npc.js.map -//# sourceMappingURL=blades-npc.js.map +//# sourceMappingURL=blades-npc.js.map \ No newline at end of file diff --git a/module/documents/actors/blades-pc.js b/module/documents/actors/blades-pc.js index bf9948dc..2bc08794 100644 --- a/module/documents/actors/blades-pc.js +++ b/module/documents/actors/blades-pc.js @@ -303,5 +303,4 @@ class BladesPC extends BladesActor { } } export default BladesPC; -//# sourceMappingURL=blades-pc.js.map -//# sourceMappingURL=blades-pc.js.map +//# sourceMappingURL=blades-pc.js.map \ No newline at end of file diff --git a/module/documents/blades-actor-proxy.js b/module/documents/blades-actor-proxy.js index 45be5b1a..409d7417 100644 --- a/module/documents/blades-actor-proxy.js +++ b/module/documents/blades-actor-proxy.js @@ -55,5 +55,4 @@ const BladesActorProxy = new Proxy(function () { }, { }); export default BladesActorProxy; export { BladesActor, BladesPC, BladesCrew, BladesNPC, BladesFaction }; -//# sourceMappingURL=blades-actor-proxy.js.map -//# sourceMappingURL=blades-actor-proxy.js.map +//# sourceMappingURL=blades-actor-proxy.js.map \ No newline at end of file diff --git a/module/documents/blades-item-location.js b/module/documents/blades-item-location.js index ec0bdd28..c65ad890 100644 --- a/module/documents/blades-item-location.js +++ b/module/documents/blades-item-location.js @@ -5,5 +5,4 @@ |* ▌██████████████████░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░███████████████████▐ *| \* ****▌███████████████████████████████████████████████████████████████████████████▐**** */ -"use strict"; -//# sourceMappingURL=blades-item-location.js.map +"use strict"; \ No newline at end of file diff --git a/module/documents/blades-item-proxy.js b/module/documents/blades-item-proxy.js index e57e9abc..07c88d74 100644 --- a/module/documents/blades-item-proxy.js +++ b/module/documents/blades-item-proxy.js @@ -55,5 +55,4 @@ const BladesItemProxy = new Proxy(function () { }, { }); export default BladesItemProxy; export { BladesItem, BladesClockKeeper, BladesGMTracker, BladesLocation, BladesScore }; -//# sourceMappingURL=blades-item-proxy.js.map -//# sourceMappingURL=blades-item-proxy.js.map +//# sourceMappingURL=blades-item-proxy.js.map \ No newline at end of file diff --git a/module/documents/items/BladesClockKeeper.js b/module/documents/items/BladesClockKeeper.js index 45e519b0..cacc1801 100644 --- a/module/documents/items/BladesClockKeeper.js +++ b/module/documents/items/BladesClockKeeper.js @@ -184,6 +184,4 @@ class BladesClockKeeper extends BladesItem { socketlib.system.executeForEveryone("renderOverlay"); } } -export default BladesClockKeeper; -//# sourceMappingURL=BladesClockKeeper.js.map -//# sourceMappingURL=BladesClockKeeper.js.map +export default BladesClockKeeper; \ No newline at end of file diff --git a/module/documents/items/BladesGMTracker.js b/module/documents/items/BladesGMTracker.js index f3a8dcfd..5c0685dc 100644 --- a/module/documents/items/BladesGMTracker.js +++ b/module/documents/items/BladesGMTracker.js @@ -24,6 +24,4 @@ class BladesGMTracker extends BladesItem { BladesActor.GetTypeWithTags(BladesActorType.pc).forEach((actor) => actor.render()); } } -export default BladesGMTracker; -//# sourceMappingURL=BladesGMTracker.js.map -//# sourceMappingURL=BladesGMTracker.js.map +export default BladesGMTracker; \ No newline at end of file diff --git a/module/documents/items/BladesLocation.js b/module/documents/items/BladesLocation.js index 32e24bce..57382a7b 100644 --- a/module/documents/items/BladesLocation.js +++ b/module/documents/items/BladesLocation.js @@ -48,6 +48,4 @@ class BladesLocation extends BladesItem { BladesActor.GetTypeWithTags(BladesActorType.pc).forEach((actor) => actor.render()); } } -export default BladesLocation; -//# sourceMappingURL=BladesLocation.js.map -//# sourceMappingURL=BladesLocation.js.map +export default BladesLocation; \ No newline at end of file diff --git a/module/documents/items/BladesScore.js b/module/documents/items/BladesScore.js index 8e3e5a39..a31bbe7e 100644 --- a/module/documents/items/BladesScore.js +++ b/module/documents/items/BladesScore.js @@ -64,6 +64,4 @@ class BladesScore extends BladesItem { BladesActor.GetTypeWithTags(BladesActorType.pc).forEach((actor) => actor.render()); } } -export default BladesScore; -//# sourceMappingURL=BladesScore.js.map -//# sourceMappingURL=BladesScore.js.map +export default BladesScore; \ No newline at end of file diff --git a/module/documents/items/blades-clock-keeper.js b/module/documents/items/blades-clock-keeper.js index 0b280587..f398fc1e 100644 --- a/module/documents/items/blades-clock-keeper.js +++ b/module/documents/items/blades-clock-keeper.js @@ -185,5 +185,4 @@ class BladesClockKeeper extends BladesItem { } } export default BladesClockKeeper; -//# sourceMappingURL=blades-clock-keeper.js.map -//# sourceMappingURL=blades-clock-keeper.js.map +//# sourceMappingURL=blades-clock-keeper.js.map \ No newline at end of file diff --git a/module/documents/items/blades-gm-tracker.js b/module/documents/items/blades-gm-tracker.js index 22a518ae..a927b03f 100644 --- a/module/documents/items/blades-gm-tracker.js +++ b/module/documents/items/blades-gm-tracker.js @@ -25,5 +25,4 @@ class BladesGMTracker extends BladesItem { } } export default BladesGMTracker; -//# sourceMappingURL=blades-gm-tracker.js.map -//# sourceMappingURL=blades-gm-tracker.js.map +//# sourceMappingURL=blades-gm-tracker.js.map \ No newline at end of file diff --git a/module/documents/items/blades-item-location.js b/module/documents/items/blades-item-location.js index ec0bdd28..c65ad890 100644 --- a/module/documents/items/blades-item-location.js +++ b/module/documents/items/blades-item-location.js @@ -5,5 +5,4 @@ |* ▌██████████████████░░░░░░░░░░░░░░░░░░ ░░░░░░░░░░░░░░░░░░███████████████████▐ *| \* ****▌███████████████████████████████████████████████████████████████████████████▐**** */ -"use strict"; -//# sourceMappingURL=blades-item-location.js.map +"use strict"; \ No newline at end of file diff --git a/module/documents/items/blades-location copy.js b/module/documents/items/blades-location copy.js index 50ba6d69..dd6bd1c2 100644 --- a/module/documents/items/blades-location copy.js +++ b/module/documents/items/blades-location copy.js @@ -8,5 +8,4 @@ import BladesItem from "../../blades-item.js"; class BladesLocation extends BladesItem { } -export default BladesLocation; -//# sourceMappingURL=blades-location copy.js.map +export default BladesLocation; \ No newline at end of file diff --git a/module/documents/items/blades-location.js b/module/documents/items/blades-location.js index 6d136b87..d6501da4 100644 --- a/module/documents/items/blades-location.js +++ b/module/documents/items/blades-location.js @@ -49,5 +49,4 @@ class BladesLocation extends BladesItem { } } export default BladesLocation; -//# sourceMappingURL=blades-location.js.map -//# sourceMappingURL=blades-location.js.map +//# sourceMappingURL=blades-location.js.map \ No newline at end of file diff --git a/module/documents/items/blades-score.js b/module/documents/items/blades-score.js index d1406780..65b746bf 100644 --- a/module/documents/items/blades-score.js +++ b/module/documents/items/blades-score.js @@ -65,5 +65,4 @@ class BladesScore extends BladesItem { } } export default BladesScore; -//# sourceMappingURL=blades-score.js.map -//# sourceMappingURL=blades-score.js.map +//# sourceMappingURL=blades-score.js.map \ No newline at end of file diff --git a/module/sheets/actor/BladesActorSheet.js b/module/sheets/actor/BladesActorSheet.js index 24e90ea4..79d7cb21 100644 --- a/module/sheets/actor/BladesActorSheet.js +++ b/module/sheets/actor/BladesActorSheet.js @@ -390,6 +390,4 @@ class BladesActorSheet extends ActorSheet { BladesActiveEffect.onManageActiveEffect(event, this.actor); } } -export default BladesActorSheet; -//# sourceMappingURL=BladesActorSheet.js.map -//# sourceMappingURL=BladesActorSheet.js.map +export default BladesActorSheet; \ No newline at end of file diff --git a/module/sheets/actor/BladesCrewSheet.js b/module/sheets/actor/BladesCrewSheet.js index f51103b8..568deac4 100644 --- a/module/sheets/actor/BladesCrewSheet.js +++ b/module/sheets/actor/BladesCrewSheet.js @@ -152,6 +152,4 @@ class BladesCrewSheet extends BladesActorSheet { }); } } -export default BladesCrewSheet; -//# sourceMappingURL=BladesCrewSheet.js.map -//# sourceMappingURL=BladesCrewSheet.js.map +export default BladesCrewSheet; \ No newline at end of file diff --git a/module/sheets/actor/BladesFactionSheet.js b/module/sheets/actor/BladesFactionSheet.js index 2f884558..01f6156c 100644 --- a/module/sheets/actor/BladesFactionSheet.js +++ b/module/sheets/actor/BladesFactionSheet.js @@ -72,6 +72,4 @@ class BladesFactionSheet extends BladesActorSheet { .on("click", this._onClockDeleteClick.bind(this)); } } -export default BladesFactionSheet; -//# sourceMappingURL=BladesFactionSheet.js.map -//# sourceMappingURL=BladesFactionSheet.js.map +export default BladesFactionSheet; \ No newline at end of file diff --git a/module/sheets/actor/BladesNPCSheet.js b/module/sheets/actor/BladesNPCSheet.js index cfaf3a93..45d268a6 100644 --- a/module/sheets/actor/BladesNPCSheet.js +++ b/module/sheets/actor/BladesNPCSheet.js @@ -90,6 +90,4 @@ class BladesNPCSheet extends BladesActorSheet { }); } } -export default BladesNPCSheet; -//# sourceMappingURL=BladesNPCSheet.js.map -//# sourceMappingURL=BladesNPCSheet.js.map +export default BladesNPCSheet; \ No newline at end of file diff --git a/module/sheets/actor/BladesPCSheet.js b/module/sheets/actor/BladesPCSheet.js index fc167992..8fe44d84 100644 --- a/module/sheets/actor/BladesPCSheet.js +++ b/module/sheets/actor/BladesPCSheet.js @@ -341,6 +341,4 @@ class BladesPCSheet extends BladesActorSheet { }); } } -export default BladesPCSheet; -//# sourceMappingURL=BladesPCSheet.js.map -//# sourceMappingURL=BladesPCSheet.js.map +export default BladesPCSheet; \ No newline at end of file diff --git a/module/sheets/actor/blades-actor-sheet.js b/module/sheets/actor/blades-actor-sheet.js index 16c50d4c..6c4c7386 100644 --- a/module/sheets/actor/blades-actor-sheet.js +++ b/module/sheets/actor/blades-actor-sheet.js @@ -343,5 +343,4 @@ class BladesActorSheet extends BladesSheet { } } export default BladesActorSheet; -//# sourceMappingURL=blades-actor-sheet.js.map -//# sourceMappingURL=blades-actor-sheet.js.map +//# sourceMappingURL=blades-actor-sheet.js.map \ No newline at end of file diff --git a/module/sheets/actor/blades-crew-sheet.js b/module/sheets/actor/blades-crew-sheet.js index 79971c56..4af43d70 100644 --- a/module/sheets/actor/blades-crew-sheet.js +++ b/module/sheets/actor/blades-crew-sheet.js @@ -153,5 +153,4 @@ class BladesCrewSheet extends BladesSheet { } } export default BladesCrewSheet; -//# sourceMappingURL=blades-crew-sheet.js.map -//# sourceMappingURL=blades-crew-sheet.js.map +//# sourceMappingURL=blades-crew-sheet.js.map \ No newline at end of file diff --git a/module/sheets/actor/blades-faction-sheet.js b/module/sheets/actor/blades-faction-sheet.js index 4d4e1d72..bffdf49d 100644 --- a/module/sheets/actor/blades-faction-sheet.js +++ b/module/sheets/actor/blades-faction-sheet.js @@ -73,5 +73,4 @@ class BladesFactionSheet extends BladesSheet { } } export default BladesFactionSheet; -//# sourceMappingURL=blades-faction-sheet.js.map -//# sourceMappingURL=blades-faction-sheet.js.map +//# sourceMappingURL=blades-faction-sheet.js.map \ No newline at end of file diff --git a/module/sheets/actor/blades-npc-sheet.js b/module/sheets/actor/blades-npc-sheet.js index 533d3189..3ca4156e 100644 --- a/module/sheets/actor/blades-npc-sheet.js +++ b/module/sheets/actor/blades-npc-sheet.js @@ -91,5 +91,4 @@ class BladesNPCSheet extends BladesSheet { } } export default BladesNPCSheet; -//# sourceMappingURL=blades-npc-sheet.js.map -//# sourceMappingURL=blades-npc-sheet.js.map +//# sourceMappingURL=blades-npc-sheet.js.map \ No newline at end of file diff --git a/module/sheets/actor/blades-pc-sheet.js b/module/sheets/actor/blades-pc-sheet.js index 52f723ff..0d558939 100644 --- a/module/sheets/actor/blades-pc-sheet.js +++ b/module/sheets/actor/blades-pc-sheet.js @@ -342,5 +342,4 @@ class BladesPCSheet extends BladesSheet { } } export default BladesPCSheet; -//# sourceMappingURL=blades-pc-sheet.js.map -//# sourceMappingURL=blades-pc-sheet.js.map +//# sourceMappingURL=blades-pc-sheet.js.map \ No newline at end of file diff --git a/module/sheets/actor/blades-sheet.js b/module/sheets/actor/blades-sheet.js index 32f632fa..2242a9a5 100644 --- a/module/sheets/actor/blades-sheet.js +++ b/module/sheets/actor/blades-sheet.js @@ -396,5 +396,4 @@ class BladesSheet extends ActorSheet { } } export default BladesSheet; -//# sourceMappingURL=blades-sheet.js.map -//# sourceMappingURL=blades-sheet.js.map +//# sourceMappingURL=blades-sheet.js.map \ No newline at end of file diff --git a/module/sheets/blades-actor-sheet.js b/module/sheets/blades-actor-sheet.js index fb680456..50ebc935 100644 --- a/module/sheets/blades-actor-sheet.js +++ b/module/sheets/blades-actor-sheet.js @@ -312,5 +312,4 @@ class BladesActorSheet extends BladesSheet { }); } } -export default BladesActorSheet; -//# sourceMappingURL=blades-actor-sheet.js.map +export default BladesActorSheet; \ No newline at end of file diff --git a/module/sheets/blades-clock-keeper-sheet.js b/module/sheets/blades-clock-keeper-sheet.js index ded40594..157adbfe 100644 --- a/module/sheets/blades-clock-keeper-sheet.js +++ b/module/sheets/blades-clock-keeper-sheet.js @@ -72,5 +72,4 @@ export default class BladesClockKeeperSheet extends BladesItemSheet { html.find("[data-action=\"delete-key\"").on("click", this.deleteKey.bind(this)); html.find(".clock-counter").on("change", this.setKeySize.bind(this)); } -} -//# sourceMappingURL=blades-clock-keeper-sheet.js.map +} \ No newline at end of file diff --git a/module/sheets/blades-crew-sheet.js b/module/sheets/blades-crew-sheet.js index d7e46553..875cda2b 100644 --- a/module/sheets/blades-crew-sheet.js +++ b/module/sheets/blades-crew-sheet.js @@ -174,5 +174,4 @@ class BladesCrewSheet extends BladesSheet { }); } } -export default BladesCrewSheet; -//# sourceMappingURL=blades-crew-sheet.js.map +export default BladesCrewSheet; \ No newline at end of file diff --git a/module/sheets/blades-faction-sheet.js b/module/sheets/blades-faction-sheet.js index 02922a54..c5cc9ec3 100644 --- a/module/sheets/blades-faction-sheet.js +++ b/module/sheets/blades-faction-sheet.js @@ -28,5 +28,4 @@ class BladesFactionSheet extends BladesSheet { }); } } -export default BladesFactionSheet; -//# sourceMappingURL=blades-faction-sheet.js.map +export default BladesFactionSheet; \ No newline at end of file diff --git a/module/sheets/blades-item-sheet.js b/module/sheets/blades-item-sheet.js index 4837b24e..aa3e24cb 100644 --- a/module/sheets/blades-item-sheet.js +++ b/module/sheets/blades-item-sheet.js @@ -183,5 +183,4 @@ class BladesItemSheet extends ItemSheet { return context; } } -export default BladesItemSheet; -//# sourceMappingURL=blades-item-sheet.js.map +export default BladesItemSheet; \ No newline at end of file diff --git a/module/sheets/blades-npc-sheet.js b/module/sheets/blades-npc-sheet.js index 9a8d7841..6b3334a8 100644 --- a/module/sheets/blades-npc-sheet.js +++ b/module/sheets/blades-npc-sheet.js @@ -38,5 +38,4 @@ class BladesNPCSheet extends BladesSheet { }); } } -export default BladesNPCSheet; -//# sourceMappingURL=blades-npc-sheet.js.map +export default BladesNPCSheet; \ No newline at end of file diff --git a/module/sheets/blades-roll-collab-sheet.js b/module/sheets/blades-roll-collab-sheet.js index 3e0af9ac..cb56c093 100644 --- a/module/sheets/blades-roll-collab-sheet.js +++ b/module/sheets/blades-roll-collab-sheet.js @@ -567,5 +567,4 @@ class BladesRollCollabSheet extends DocumentSheet { return super.render(force, options); } } -export default BladesRollCollabSheet; -//# sourceMappingURL=blades-roll-collab-sheet.js.map +export default BladesRollCollabSheet; \ No newline at end of file diff --git a/module/sheets/blades-sheet.js b/module/sheets/blades-sheet.js index e7a91097..1ace4aad 100644 --- a/module/sheets/blades-sheet.js +++ b/module/sheets/blades-sheet.js @@ -374,5 +374,4 @@ class BladesSheet extends ActorSheet { BladesActiveEffect.onManageActiveEffect(event, this.actor); } } -export default BladesSheet; -//# sourceMappingURL=blades-sheet.js.map +export default BladesSheet; \ No newline at end of file diff --git a/module/sheets/blades-tracker-sheet.js b/module/sheets/blades-tracker-sheet.js index 53bea936..762d1c18 100644 --- a/module/sheets/blades-tracker-sheet.js +++ b/module/sheets/blades-tracker-sheet.js @@ -91,5 +91,4 @@ class BladesTrackerSheet extends BladesItemSheet { super.activateListeners(html); } } -export default BladesTrackerSheet; -//# sourceMappingURL=blades-tracker-sheet.js.map +export default BladesTrackerSheet; \ No newline at end of file diff --git a/module/sheets/item/BladesClockKeeperSheet.js b/module/sheets/item/BladesClockKeeperSheet.js index 0ce8cc66..41de5c7e 100644 --- a/module/sheets/item/BladesClockKeeperSheet.js +++ b/module/sheets/item/BladesClockKeeperSheet.js @@ -78,6 +78,4 @@ class BladesClockKeeperSheet extends BladesItemSheet { html.find(".key-clock-counter").on("change", this.setKeySize.bind(this)); } } -export default BladesClockKeeperSheet; -//# sourceMappingURL=BladesClockKeeperSheet.js.map -//# sourceMappingURL=BladesClockKeeperSheet.js.map +export default BladesClockKeeperSheet; \ No newline at end of file diff --git a/module/sheets/item/BladesGMTrackerSheet.js b/module/sheets/item/BladesGMTrackerSheet.js index 43997f3f..58ec2ed4 100644 --- a/module/sheets/item/BladesGMTrackerSheet.js +++ b/module/sheets/item/BladesGMTrackerSheet.js @@ -127,6 +127,4 @@ class BladesGMTrackerSheet extends BladesItemSheet { return submitData; } } -export default BladesGMTrackerSheet; -//# sourceMappingURL=BladesGMTrackerSheet.js.map -//# sourceMappingURL=BladesGMTrackerSheet.js.map +export default BladesGMTrackerSheet; \ No newline at end of file diff --git a/module/sheets/item/BladesItemSheet.js b/module/sheets/item/BladesItemSheet.js index e0baeb6a..c8fb32b0 100644 --- a/module/sheets/item/BladesItemSheet.js +++ b/module/sheets/item/BladesItemSheet.js @@ -401,6 +401,4 @@ class BladesItemSheet extends ItemSheet { this.item.update(updateData); } } -export default BladesItemSheet; -//# sourceMappingURL=BladesItemSheet.js.map -//# sourceMappingURL=BladesItemSheet.js.map +export default BladesItemSheet; \ No newline at end of file diff --git a/module/sheets/item/BladesScoreSheet.js b/module/sheets/item/BladesScoreSheet.js index 82aaee06..34a2989a 100644 --- a/module/sheets/item/BladesScoreSheet.js +++ b/module/sheets/item/BladesScoreSheet.js @@ -286,6 +286,4 @@ class BladesScoreSheet extends BladesItemSheet { return submitData; } } -export default BladesScoreSheet; -//# sourceMappingURL=BladesScoreSheet.js.map -//# sourceMappingURL=BladesScoreSheet.js.map +export default BladesScoreSheet; \ No newline at end of file diff --git a/module/sheets/item/blades-clock-keeper-sheet.js b/module/sheets/item/blades-clock-keeper-sheet.js index 157a54cb..5fdaa2a1 100644 --- a/module/sheets/item/blades-clock-keeper-sheet.js +++ b/module/sheets/item/blades-clock-keeper-sheet.js @@ -79,5 +79,4 @@ class BladesClockKeeperSheet extends BladesItemSheet { } } export default BladesClockKeeperSheet; -//# sourceMappingURL=blades-clock-keeper-sheet.js.map -//# sourceMappingURL=blades-clock-keeper-sheet.js.map +//# sourceMappingURL=blades-clock-keeper-sheet.js.map \ No newline at end of file diff --git a/module/sheets/item/blades-item-sheet.js b/module/sheets/item/blades-item-sheet.js index a01d8101..75779006 100644 --- a/module/sheets/item/blades-item-sheet.js +++ b/module/sheets/item/blades-item-sheet.js @@ -402,5 +402,4 @@ class BladesItemSheet extends ItemSheet { } } export default BladesItemSheet; -//# sourceMappingURL=blades-item-sheet.js.map -//# sourceMappingURL=blades-item-sheet.js.map +//# sourceMappingURL=blades-item-sheet.js.map \ No newline at end of file diff --git a/module/sheets/item/blades-score-sheet.js b/module/sheets/item/blades-score-sheet.js index 2e53dc84..e09aaa74 100644 --- a/module/sheets/item/blades-score-sheet.js +++ b/module/sheets/item/blades-score-sheet.js @@ -287,5 +287,4 @@ class BladesScoreSheet extends BladesItemSheet { } } export default BladesScoreSheet; -//# sourceMappingURL=blades-score-sheet.js.map -//# sourceMappingURL=blades-score-sheet.js.map +//# sourceMappingURL=blades-score-sheet.js.map \ No newline at end of file diff --git a/module/sheets/item/blades-tracker-sheet copy.js b/module/sheets/item/blades-tracker-sheet copy.js index cf957371..5dc08f05 100644 --- a/module/sheets/item/blades-tracker-sheet copy.js +++ b/module/sheets/item/blades-tracker-sheet copy.js @@ -127,5 +127,4 @@ class BladesTrackerSheet extends BladesItemSheet { return submitData; } } -export default BladesTrackerSheet; -//# sourceMappingURL=blades-tracker-sheet copy.js.map +export default BladesTrackerSheet; \ No newline at end of file diff --git a/module/sheets/item/blades-tracker-sheet.js b/module/sheets/item/blades-tracker-sheet.js index 7080dd6b..5227354b 100644 --- a/module/sheets/item/blades-tracker-sheet.js +++ b/module/sheets/item/blades-tracker-sheet.js @@ -126,5 +126,4 @@ class BladesTrackerSheet extends BladesItemSheet { } } export default BladesTrackerSheet; -//# sourceMappingURL=blades-tracker-sheet.js.map -//# sourceMappingURL=blades-tracker-sheet.js.map +//# sourceMappingURL=blades-tracker-sheet.js.map \ No newline at end of file diff --git a/module/sheets/roll/blades-roll-collab-sheet.js b/module/sheets/roll/blades-roll-collab-sheet.js index 25bb6248..5a7cc706 100644 --- a/module/sheets/roll/blades-roll-collab-sheet.js +++ b/module/sheets/roll/blades-roll-collab-sheet.js @@ -638,5 +638,4 @@ class BladesRollCollabSheet extends DocumentSheet { return super.render(force, options); } } -export default BladesRollCollabSheet; -//# sourceMappingURL=blades-roll-collab-sheet.js.map +export default BladesRollCollabSheet; \ No newline at end of file diff --git a/ts/@types/blades-roll.d.ts b/ts/@types/blades-roll.d.ts index 8958cba1..1460004e 100644 --- a/ts/@types/blades-roll.d.ts +++ b/ts/@types/blades-roll.d.ts @@ -45,7 +45,7 @@ declare global { export interface Config { rollType: RollType, - rollStorageID: string, + rollUserID: string, rollPrimaryData: PrimaryDocData; rollOppData?: OppositionDocData; rollParticipantData?: RollParticipantData, @@ -54,8 +54,7 @@ declare global { rollTrait?: RollTrait, participantRollTo?: string } - export type ConstructorConfig = Required> - & Partial> + export type ConstructorConfig = Partial & Required>; export interface ConsequenceData extends Partial { type: ConsequenceType, @@ -82,30 +81,13 @@ declare global { export interface FlagData { rollID: string; - storageDocID: string; rollType: RollType; rollSubType?: RollSubType; rollDowntimeAction?: DowntimeAction; rollPrimaryData: PrimaryDocData; rollOppData?: OppositionDocData; - rollParticipantData?: { - [RollModSection.roll]?: { - Assist?: ParticipantDocData, - Group_1?: ParticipantDocData, - Group_2?: ParticipantDocData, - Group_3?: ParticipantDocData, - Group_4?: ParticipantDocData, - Group_5?: ParticipantDocData, - Group_6?: ParticipantDocData, - }, - [RollModSection.position]?: { - Setup: ParticipantDocData - }, - [RollModSection.effect]?: { - Setup: ParticipantDocData - } - }, + rollParticipantData?: RollParticipantData; rollTrait?: RollTrait; rollModsData: Record; rollPositionInitial: Position; diff --git a/ts/BladesRollCollab.ts b/ts/BladesRollCollab.ts index e8f2b7f9..a62f5689 100644 --- a/ts/BladesRollCollab.ts +++ b/ts/BladesRollCollab.ts @@ -769,7 +769,6 @@ class BladesRollParticipant implements BladesRollCollab.ParticipantDocData { } // #endregion *** CLASSES *** BladesRollPrimary, BladesRollOpposition, BladesRollParticipant -// #region *** CLASS *** BladesRollCollab class BladesRollCollab extends DocumentSheet { // #region STATIC METHODS: INITIALIZATION & DEFAULTS ~ @@ -897,7 +896,7 @@ class BladesRollCollab extends DocumentSheet { } ]; } - static get DefaultFlagData(): Omit { + static get DefaultFlagData(): Omit { return { rollModsData: {}, rollPositionInitial: Position.risky, @@ -995,8 +994,9 @@ class BladesRollCollab extends DocumentSheet { BladesRollCollab._Active = val; } - static async RenderRollCollab({storageID, rollID, rollPermission}: {userID: string, storageID: string, rollID: string, rollPermission: RollPermissions}) { - const rollInst = new BladesRollCollab(storageID, rollID, rollPermission); + static async RenderRollCollab({userID, rollID, rollPermission}: {userID: string, rollID: string, rollPermission: RollPermissions}) { + const rollInst = new BladesRollCollab(userID, rollID, rollPermission); + eLog.checkLog3("rollCollab", "RenderRollCollab()", {params: {userID, rollID, rollPermission}, rollInst}); await rollInst._render(true); } @@ -1020,30 +1020,21 @@ class BladesRollCollab extends DocumentSheet { throw new Error("[BladesRollCollab.NewRoll()] You must provide a valid rollType in the config object."); } - // If no rollStorageID is provided, attempt to derive it from the rest of the config object - if (!config.rollStorageID) { - if (config.rollPrimaryData instanceof BladesActor || config.rollPrimaryData instanceof BladesItem) { - config.rollStorageID = config.rollPrimaryData.id; - } else if (typeof config.rollPrimaryData?.rollPrimaryID === "string") { - config.rollStorageID = config.rollPrimaryData.rollPrimaryID; - } else if (!game.user.isGM && game.user instanceof User && BladesRollPrimary.IsDoc(game.user.character)) { - config.rollStorageID = game.user.character.id; - } - } - const rollStorageDoc = game.actors.get(config.rollStorageID ?? "") ?? game.items.get(config.rollStorageID ?? "") ?? false; - if (!rollStorageDoc) { - throw new Error("[BladesRollCollab.NewRoll()] A valid rollStorage document must be provided to construct a roll."); + // If no userID provided, derive from current user. + config.rollUserID ??= game.user.id ?? undefined; + + // If no valid user can be found, throw an error. + const rollUser = game.users.get(config.rollUserID ?? ""); + if (!rollUser) { + throw new Error("[BladesRollCollab.NewRoll()] You must provide a valid rollUserID in the config object."); } // If no rollPrimaryData is provided, attempt to derive it from the rest of the config object if (!BladesRollPrimary.IsValidData(config.rollPrimaryData)) { let rollPrimarySourceData: BladesRollCollab.PrimaryDocData; // If the user is a player with a BladesPC character, assume that is rollPrimary. - if (!game.user.isGM && BladesPC.IsType(game.user.character)) { - rollPrimarySourceData = game.user.character; - // If the storageDoc is a valid rollPrimary, assume that is rollPrimary. - } else if (BladesRollPrimary.IsDoc(rollStorageDoc)) { - rollPrimarySourceData = rollStorageDoc; + if (BladesPC.IsType(rollUser.character)) { + rollPrimarySourceData = rollUser.character; } else { throw new Error("[BladesRollCollab.NewRoll()] A valid source of PrimaryDocData must be provided to construct a roll."); } @@ -1065,7 +1056,6 @@ class BladesRollCollab extends DocumentSheet { const flagUpdateData: BladesRollCollab.FlagData = { ...BladesRollCollab.DefaultFlagData, rollID, - storageDocID: rollStorageDoc.id, rollType: config.rollType, rollPrimaryData: config.rollPrimaryData }; @@ -1115,13 +1105,7 @@ class BladesRollCollab extends DocumentSheet { eLog.checkLog3("bladesRoll", "BladesRollCollab.NewRoll()", {flagUpdateData, rollPrimaryData: flagUpdateData.rollPrimaryData}); // Store the roll data on the storage document - if (rollStorageDoc instanceof BladesActor) { - await rollStorageDoc.setFlag(C.SYSTEM_ID, `rollCollab.${flagUpdateData.rollID}`, flagUpdateData); - } else if (rollStorageDoc instanceof BladesItem) { - await rollStorageDoc.setFlag(C.SYSTEM_ID, `rollCollab.${flagUpdateData.rollID}`, flagUpdateData); - } else { - throw new Error("rollStorageDoc must be an instance of Actor or Item"); - } + await rollUser.setFlag(C.SYSTEM_ID, "rollCollab", flagUpdateData); // Compile the list of users for whom the roll will be displayed const userIDs: { @@ -1185,31 +1169,29 @@ class BladesRollCollab extends DocumentSheet { } // Send out socket calls to all users to see the roll. - socketlib.system.executeForAllGMs("renderRollCollab", {storageID: rollStorageDoc.id, rollID, rollPermission: RollPermissions.GM}); - socketlib.system.executeForUsers("renderRollCollab", userIDs.primary, {storageID: rollStorageDoc.id, rollID, rollPermission: RollPermissions.Primary}); - socketlib.system.executeForUsers("renderRollCollab", userIDs.participants, {storageID: rollStorageDoc.id, rollID, rollPermission: RollPermissions.Participant}); - socketlib.system.executeForUsers("renderRollCollab", userIDs.observers, {storageID: rollStorageDoc.id, rollID, rollPermission: RollPermissions.Observer}); + socketlib.system.executeForAllGMs("renderRollCollab", {userID: rollUser.id, rollID, rollPermission: RollPermissions.GM}); + socketlib.system.executeForUsers("renderRollCollab", userIDs.primary, {userID: rollUser.id, rollID, rollPermission: RollPermissions.Primary}); + socketlib.system.executeForUsers("renderRollCollab", userIDs.participants, {userID: rollUser.id, rollID, rollPermission: RollPermissions.Participant}); + socketlib.system.executeForUsers("renderRollCollab", userIDs.observers, {userID: rollUser.id, rollID, rollPermission: RollPermissions.Observer}); } // #endregion // #region Constructor ~ - storageID: string; rollID: string; rollPermission: RollPermissions; _rollPrimary: BladesRollPrimary; _rollOpposition?: BladesRollOpposition; _rollParticipants?: BladesRollCollab.RollParticipantDocs; - constructor(storageID: string, rollID: string, rollPermission: RollPermissions) { - const storageDoc = game.actors.get(storageID) ?? game.items.get(storageID); - if (!storageDoc) { - throw new Error(`Unable to retrieve storage document with ID '${storageID}'`); + constructor(userID: string, rollID: string, rollPermission: RollPermissions) { + const rollUser = game.users.get(userID); + if (!rollUser) { + throw new Error("[new BladesRollCollab()] Must provide a valid rollUser to roll."); } - super(storageDoc); - this.storageID = storageID; + super(rollUser); this.rollID = rollID; this.rollPermission = rollPermission; - const rollFlagData = storageDoc.getFlag(C.SYSTEM_ID, `rollCollab.${rollID}`) as BladesRollCollab.FlagData; + const rollFlagData = rollUser.getFlag(C.SYSTEM_ID, "rollCollab") as BladesRollCollab.FlagData; this._rollPrimary = new BladesRollPrimary(this, rollFlagData.rollPrimaryData); if (rollFlagData.rollOppData) { this._rollOpposition = new BladesRollOpposition(this, rollFlagData.rollOppData); @@ -1220,7 +1202,7 @@ class BladesRollCollab extends DocumentSheet { if ([RollModSection.roll, RollModSection.position, RollModSection.effect].includes(rollSection as RollModSection) && !U.isEmpty(rollParticipantList)) { const sectionParticipants: Record = {}; for (const [participantType, participantData] of Object.entries(rollParticipantList)) { - sectionParticipants[participantType] = new BladesRollParticipant(this, participantData); + sectionParticipants[participantType] = new BladesRollParticipant(this, participantData as Partial | undefined); } this._rollParticipants[rollSection as RollModSection.roll|RollModSection.position|RollModSection.effect] = sectionParticipants; } @@ -1233,15 +1215,24 @@ class BladesRollCollab extends DocumentSheet { // #region Basic User Flag Getters/Setters ~ get flagData(): BladesRollCollab.FlagData { - if (!this.document.getFlag(C.SYSTEM_ID, `rollCollab.${this.rollID}`)) { - throw new Error("[get flags()] No RollCollab Flags Found on Storage Document"); + if (!this.document.getFlag(C.SYSTEM_ID, "rollCollab")) { + throw new Error("[get flags()] No RollCollab Flags Found on User Document"); } - return this.document.getFlag(C.SYSTEM_ID, `rollCollab.${this.rollID}`) as BladesRollCollab.FlagData; + return this.document.getFlag(C.SYSTEM_ID, "rollCollab") as BladesRollCollab.FlagData; } get rollPrimary(): BladesRollPrimary { return this._rollPrimary; } + get rollPrimaryDoc(): BladesRollCollab.PrimaryDoc|undefined { + if (BladesRollPrimary.IsDoc(this.rollPrimary.rollPrimaryDoc)) { + return this.rollPrimary.rollPrimaryDoc; + } + if (BladesRollPrimary.IsDoc(this.rollPrimary)) { + return this.rollPrimary; + } + return undefined; + } get rollOpposition(): BladesRollOpposition|undefined { if (this._rollOpposition instanceof BladesRollOpposition) { @@ -1273,24 +1264,22 @@ class BladesRollCollab extends DocumentSheet { get rollTraitValOverride(): number | undefined { return this._rollTraitValOverride } set rollTraitValOverride(val: number | undefined) { this._rollTraitValOverride = val } get rollTraitData(): NamedValueMax & {gmTooltip?: string, pcTooltip?: string} { - const {rollPrimaryDoc} = this.rollPrimary ?? {}; - if (!BladesRollPrimary.IsDoc(rollPrimaryDoc)) { throw new Error("[get rollTraitData()] Missing Roll Primary!") } - if (BladesActor.IsType(rollPrimaryDoc, BladesActorType.pc)) { + if (BladesActor.IsType(this.rollPrimaryDoc, BladesActorType.pc)) { if (isAction(this.rollTrait)) { return { name: this.rollTrait, - value: this.rollTraitValOverride ?? rollPrimaryDoc.actions[this.rollTrait], - max: this.rollTraitValOverride ?? rollPrimaryDoc.actions[this.rollTrait], - pcTooltip: rollPrimaryDoc.rollTraitPCTooltipActions, + value: this.rollTraitValOverride ?? this.rollPrimaryDoc.actions[this.rollTrait], + max: this.rollTraitValOverride ?? this.rollPrimaryDoc.actions[this.rollTrait], + pcTooltip: this.rollPrimaryDoc.rollTraitPCTooltipActions, gmTooltip: C.ActionTooltipsGM[this.rollTrait] }; } if (isAttribute(this.rollTrait)) { return { name: this.rollTrait, - value: this.rollTraitValOverride ?? rollPrimaryDoc.attributes[this.rollTrait], - max: this.rollTraitValOverride ?? rollPrimaryDoc.attributes[this.rollTrait], - pcTooltip: rollPrimaryDoc.rollTraitPCTooltipAttributes, + value: this.rollTraitValOverride ?? this.rollPrimaryDoc.attributes[this.rollTrait], + max: this.rollTraitValOverride ?? this.rollPrimaryDoc.attributes[this.rollTrait], + pcTooltip: this.rollPrimaryDoc.rollTraitPCTooltipAttributes, gmTooltip: C.AttributeTooltips[this.rollTrait] }; } @@ -1305,14 +1294,14 @@ class BladesRollCollab extends DocumentSheet { if (isFactor(this.rollTrait)) { return { name: U.tCase(this.rollTrait), - value: this.rollTraitValOverride ?? this.rollPrimary?.rollFactors[this.rollTrait]?.value ?? 0, - max: this.rollTraitValOverride ?? this.rollPrimary?.rollFactors[this.rollTrait]?.max ?? 10 + value: this.rollTraitValOverride ?? this.rollPrimary.rollFactors[this.rollTrait]?.value ?? 0, + max: this.rollTraitValOverride ?? this.rollPrimary.rollFactors[this.rollTrait]?.max ?? 10 }; } throw new Error(`[get rollTraitData] Invalid rollTrait: '${this.rollTrait}'`); } get rollTraitOptions(): Array<{ name: string, value: BladesRollCollab.RollTrait }> { - if (BladesActor.IsType(this.rollPrimary, BladesActorType.pc)) { + if (BladesActor.IsType(this.rollPrimaryDoc, BladesActorType.pc)) { if (isAction(this.rollTrait)) { return Object.values(ActionTrait) .map((action) => ({ @@ -1407,7 +1396,7 @@ class BladesRollCollab extends DocumentSheet { } get rollFactors(): Record<"source" | "opposition", Partial>> { - const sourceFactors: Partial> = Object.fromEntries((Object.entries(this.rollPrimary?.rollFactors ?? {}) as Array<[Factor, BladesRollCollab.FactorData]>) + const sourceFactors: Partial> = Object.fromEntries((Object.entries(this.rollPrimary.rollFactors) as Array<[Factor, BladesRollCollab.FactorData]>) .map(([factor, factorData]) => [ factor, { @@ -1541,9 +1530,8 @@ class BladesRollCollab extends DocumentSheet { while (holdKeys.length) { const thisTarget = holdKeys.pop()?.split(/-/)?.pop(); if (thisTarget === "BestAction") { - const {rollPrimaryDoc} = this.rollPrimary ?? {}; - if (BladesActor.IsType(rollPrimaryDoc, BladesActorType.pc)) { - this.rollTraitValOverride = Math.max(...Object.values(rollPrimaryDoc.actions)); + if (BladesPC.IsType(this.rollPrimaryDoc)) { + this.rollTraitValOverride = Math.max(...Object.values(this.rollPrimaryDoc.actions)); } } else { const [targetName, targetCat, targetPosNeg] = thisTarget?.split(/,/) as [string, RollModSection | undefined, "positive" | "negative" | undefined] | undefined ?? []; @@ -1781,8 +1769,6 @@ class BladesRollCollab extends DocumentSheet { override async getData() { const context = super.getData(); - if (!this.rollPrimary) {throw new Error("No roll source configured for roll.")} - this.initRollMods(this.getRollModsData()); this.rollMods.forEach((rollMod) => rollMod.applyRollModEffectKeys()); @@ -1798,7 +1784,7 @@ class BladesRollCollab extends DocumentSheet { private getRollModsData(): BladesRollCollab.RollModData[] { const defaultMods = [ ...BladesRollCollab.DefaultRollMods, - ...this.rollPrimary?.rollModsData ?? [] + ...this.rollPrimary.rollModsData ]; if (this.rollOpposition?.rollOppModsData) { return [ @@ -1877,7 +1863,7 @@ class BladesRollCollab extends DocumentSheet { cssClass: "roll-collab", editable: this.options.editable, isGM, - system: this.rollPrimary?.rollPrimaryDoc?.system, + system: this.rollPrimaryDoc?.system, rollMods, rollPrimary, @@ -1915,6 +1901,7 @@ class BladesRollCollab extends DocumentSheet { return { ...baseData, + ...(this.rollPrimary.rollPrimaryDoc ? {rollPrimary: this.rollPrimary.rollPrimaryDoc} : {}), ...rollPositionData, ...rollEffectData, ...rollResultData, @@ -1967,8 +1954,6 @@ class BladesRollCollab extends DocumentSheet { }; } - // Add additional helper methods for calculateOddsGradient, calculatePositionEffectTradeData, calculateRollModsCategoryData, calculateHasInactiveConditionalsData, calculateCostsData - // These methods will contain the respective logic for each, using the same structure as the previous helper methods. /** * Calculate odds gradient based on given dice total. * @param diceTotal - Total number of dice. @@ -2074,220 +2059,6 @@ class BladesRollCollab extends DocumentSheet { } return undefined; } - - - async OLDgetData() { - - const context = super.getData(); - - const rData = this.flagData; - - if (!this.rollPrimary) { - throw new Error("No roll source configured for roll."); - } - - // Initialize roll mods from all available sources - const rollModsData: BladesRollCollab.RollModData[] = [ - ...BladesRollCollab.DefaultRollMods, - ...this.rollPrimary.rollModsData ?? [] - ]; - - if (this.rollOpposition?.rollOppModsData) { - rollModsData.push(...this.rollOpposition.rollOppModsData); - } - - this.initRollMods(rollModsData); - - this.rollMods.forEach((rollMod) => rollMod.applyRollModEffectKeys()); - - const isGM = game.eunoblades.Tracker?.system.is_spoofing_player ? false : game.user.isGM; - const {rollPrimary, rollOpposition, rollTraitData, rollTraitOptions, finalPosition, finalEffect, finalResult, rollMods, posEffectTrade, rollFactors} = this; - - const rollCosts = this.getActiveRollMods() - .map((rollMod) => rollMod.costs) - .flat() - .filter((costData): costData is BladesRollCollab.CostData => costData !== undefined); - const stressCosts = rollCosts.filter((costData) => costData.costType === "Stress"); - const specArmorCost = rollCosts.find((costData) => costData.costType === "SpecialArmor"); - const totalStressCost = U.sum(stressCosts.map((costData) => costData.costAmount)); - - const sheetData: BladesRollCollab.SheetData = { - ...rData, - cssClass: "roll-collab", - editable: this.options.editable, - isGM, - system: this.rollPrimary.rollPrimaryDoc?.system, - - rollMods, - rollPrimary, - rollTraitData, - rollTraitOptions, - - diceTotal: this.finalDicePool, - - rollOpposition, - - rollPositions: Object.values(Position), - rollEffects: Object.values(Effect), - teamworkDocs: game.actors.filter((actor) => BladesActor.IsType(actor, BladesActorType.pc)), - - rollPositionFinal: finalPosition, - rollEffectFinal: finalEffect, - rollResultFinal: finalResult, - isAffectingResult: finalResult > 0 - || this.getVisibleRollMods(RollModSection.result).length > 0 - || (isGM && this.getRollMods(RollModSection.result).length > 0), - isAffectingAfter: this.getVisibleRollMods(RollModSection.after).length > 0 - || (isGM && this.getRollMods(RollModSection.after).length > 0), - - rollFactorPenaltiesNegated: this.rollFactorPenaltiesNegated, - - GMBoosts: { - Dice: this.flagData.GMBoosts.Dice ?? 0, - [Factor.tier]: this.flagData.GMBoosts[Factor.tier] ?? 0, - [Factor.quality]: this.flagData.GMBoosts[Factor.quality] ?? 0, - [Factor.scale]: this.flagData.GMBoosts[Factor.scale] ?? 0, - [Factor.magnitude]: this.flagData.GMBoosts[Factor.magnitude] ?? 0, - Result: this.flagData.GMBoosts.Result ?? 0 - }, - GMOppBoosts: { - [Factor.tier]: this.flagData.GMOppBoosts[Factor.tier] ?? 0, - [Factor.quality]: this.flagData.GMOppBoosts[Factor.quality] ?? 0, - [Factor.scale]: this.flagData.GMOppBoosts[Factor.scale] ?? 0, - [Factor.magnitude]: this.flagData.GMOppBoosts[Factor.magnitude] ?? 0 - }, - - canTradePosition: posEffectTrade === "position" - || ( - posEffectTrade === false - && finalPosition !== Position.desperate - && finalEffect !== Effect.extreme - ), - canTradeEffect: posEffectTrade === "effect" - || ( - posEffectTrade === false - && finalPosition !== Position.controlled - && finalEffect !== Effect.zero - ), - - posRollMods: Object.fromEntries(Object.values(RollModSection) - .map((cat) => [cat, this.getRollMods(cat, "positive")])) as Record, - negRollMods: Object.fromEntries(Object.values(RollModSection) - .map((cat) => [cat, this.getRollMods(cat, "negative")])) as Record, - hasInactiveConditionals: { - [RollModSection.roll]: this.getRollMods(RollModSection.roll) - .filter((mod) => mod.isInInactiveBlock) - .length > 0, - [RollModSection.position]: this.getRollMods(RollModSection.position) - .filter((mod) => mod.isInInactiveBlock) - .length > 0, - [RollModSection.effect]: this.getRollMods(RollModSection.effect) - .filter((mod) => mod.isInInactiveBlock) - .length > 0, - [RollModSection.result]: this.getRollMods(RollModSection.result) - .filter((mod) => mod.isInInactiveBlock) - .length > 0, - [RollModSection.after]: this.getRollMods(RollModSection.after) - .filter((mod) => mod.isInInactiveBlock) - .length > 0 - }, - - rollFactors, - - oddsGradient: "" - }; - - // Determine final costs for tooltip and footer label - if (specArmorCost || totalStressCost) { - sheetData.costData = { - footerLabel: [ - "( Roll Costs", - totalStressCost > 0 - ? `${totalStressCost} Stress` - : null, - specArmorCost && totalStressCost - ? "and" - : null, - specArmorCost - ? "your Special Armor" - : null, - ")" - ] - .filter((line) => Boolean(line)) - .join(" "), - tooltip: [ - "

Roll Costs

    ", - ...stressCosts.map((costData) => `
  • ${costData.label}: ${costData.costAmount} Stress
  • `), - specArmorCost - ? `
  • ${specArmorCost.label}: Special Armor
  • ` - : null, - "
" - ] - .filter((line) => Boolean(line)) - .join("") - }; - } - - // Determine style string for odds bar - const oddsColors = { - crit: "var(--blades-cyan)", - success: "var(--blades-gold)", - partial: "var(--blades-grey-bright)", - fail: "var(--blades-black-dark)" - }; - const odds = {...C.DiceOdds[sheetData.diceTotal ?? 0]}; - - // Apply changes to odds from result level - if ((sheetData.rollResultFinal ?? 0) < 0) { - for (let i = sheetData.rollResultFinal ?? 0; i < 0; i++) { - // For each negative shift, bump all the colors down one level. - oddsColors.crit = oddsColors.success; - oddsColors.success = oddsColors.partial; - oddsColors.partial = oddsColors.fail; - } - } else if ((sheetData.rollResultFinal ?? 0) > 0) { - for (let i = 0; i < (sheetData.rollResultFinal ?? 0); i++) { - // For each positive shift, bump all the colors up one level. - oddsColors.fail = oddsColors.partial; - oddsColors.partial = oddsColors.success; - oddsColors.success = oddsColors.crit; - } - } - - const gradientStops = { - fail: odds.fail, - partial: odds.fail + odds.partial, - success: odds.fail + odds.partial + odds.success - }; - - // Apply tuning for visuals - gradientStops.fail = Math.min(100, Math.max(0, Math.max(gradientStops.fail / 2, gradientStops.fail - 10))); - const critSpan = 100 - gradientStops.success; - gradientStops.success = Math.min(100, Math.max(0, gradientStops.success - Math.max(critSpan / 2, critSpan - 10))); - - sheetData.oddsGradient = [ - "linear-gradient(to right", - `${oddsColors.fail} ${gradientStops.fail}%`, - `${oddsColors.partial} ${gradientStops.partial}%`, - `${oddsColors.success} ${gradientStops.success}%`, - `${oddsColors.crit})` - ].join(", "); - - sheetData.oddsGradientTestHTML = [ - "
", - `
`, - `
`, - `
`, - `
`, - "
" - ].join(""); - - return { - ...context, - ...sheetData - }; - } - // #endregion // #region *** EVALUATING & DISPLAYING ROLL TO CHAT *** ~ @@ -2365,7 +2136,7 @@ class BladesRollCollab extends DocumentSheet { switch (this.rollType) { case RollType.Action: { renderedHTML = await renderTemplate("systems/eunos-blades/templates/chat/action-roll.hbs", { - sourceName: this.rollPrimary?.rollPrimaryName ?? "", + sourceName: this.rollPrimary.rollPrimaryName, oppName: this.rollOpposition?.rollOppName, type: U.lCase(this.rollType), subType: U.lCase(this.rollSubType), @@ -2669,7 +2440,6 @@ class BladesRollCollab extends DocumentSheet { interface BladesRollCollab { get document(): User } -// #endregion *** CLASS *** BladesRollCollab // #region EXPORTS ~ export const BladesRollCollabComps = { diff --git a/ts/documents/actors/BladesPC.ts b/ts/documents/actors/BladesPC.ts index 1eeb1e70..1bc57402 100644 --- a/ts/documents/actors/BladesPC.ts +++ b/ts/documents/actors/BladesPC.ts @@ -1,8 +1,7 @@ -import BladesItem from "../../BladesItem.js"; import C, {Playbook, AttributeTrait, ActionTrait, Harm, BladesActorType, BladesItemType, Tag, RollModSection, Factor, RollModStatus} from "../../core/constants.js"; import U from "../../core/utilities.js"; -import BladesActor from "../../BladesActor.js"; -import BladesCrew from "./BladesCrew.js"; +import {BladesActor, BladesCrew} from "../BladesActorProxy.js"; +import {BladesItem} from "../BladesItemProxy.js"; import BladesRollCollab, {BladesRollMod} from "../../BladesRollCollab.js"; import type {ActorDataConstructorData} from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/data/data.mjs/actorData.js";