Skip to content

Commit

Permalink
feat: Add map (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
aMediocreDad authored Mar 6, 2024
1 parent cbd7731 commit 1bfe434
Show file tree
Hide file tree
Showing 23 changed files with 137 additions and 46 deletions.
Binary file added assets/fonts/litm-dice.otf
Binary file not shown.
Binary file added assets/media/scenes/map-of-the-dales.webp
Binary file not shown.
2 changes: 2 additions & 0 deletions litm.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { LitmRollDialog } from "./scripts/apps/roll-dialog.js";
import { LitmConfig } from "./scripts/system/config.js";
import { LitmSettings } from "./scripts/system/settings.js";
import { Enrichers } from "./scripts/system/enrichers.js";
import { DENOMINATION, DoubleSix } from "./scripts/apps/dice.js";

// Set the logo to the LitM logo
$("#logo")[0].src = "systems/litm/assets/media/logo.webp";
Expand All @@ -41,6 +42,7 @@ Hooks.once("init", () => {
info("Initializing Config...");
CONFIG.Actor.dataModels.character = CharacterData;
CONFIG.Actor.dataModels.challenge = ChallengeData;
CONFIG.Dice.terms[DENOMINATION] = DoubleSix;
CONFIG.Dice.rolls.push(LitmRoll);
CONFIG.Item.dataModels.theme = ThemeData;
CONFIG.Item.dataModels.threat = ThreatData;
Expand Down
2 changes: 2 additions & 0 deletions packs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/**
!.gitignore
Binary file removed packs/tinderbox-demo/000044.ldb
Binary file not shown.
Binary file added packs/tinderbox-demo/000057.ldb
Binary file not shown.
File renamed without changes.
2 changes: 1 addition & 1 deletion packs/tinderbox-demo/CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MANIFEST-000045
MANIFEST-000058
14 changes: 7 additions & 7 deletions packs/tinderbox-demo/LOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
2024/03/05-08:46:42.128520 16f3c7000 Recovering log #42
2024/03/05-08:46:42.129076 16f3c7000 Delete type=3 #40
2024/03/05-08:46:42.129139 16f3c7000 Delete type=0 #42
2024/03/05-08:48:53.698328 16fc5f000 Level-0 table #48: started
2024/03/05-08:48:53.698351 16fc5f000 Level-0 table #48: 0 bytes OK
2024/03/05-08:48:53.698440 16fc5f000 Delete type=0 #46
2024/03/05-08:48:53.698999 16fc5f000 Manual compaction at level-0 from '!adventures!6Gp864ZlopbT97Zy' @ 72057594037927935 : 1 .. '!adventures!6Gp864ZlopbT97Zy' @ 0 : 0; will stop at (end)
2024/03/05-14:15:42.638944 16edeb000 Recovering log #55
2024/03/05-14:15:42.639544 16edeb000 Delete type=3 #53
2024/03/05-14:15:42.639633 16edeb000 Delete type=0 #55
2024/03/05-14:16:50.636614 17069b000 Level-0 table #61: started
2024/03/05-14:16:50.636655 17069b000 Level-0 table #61: 0 bytes OK
2024/03/05-14:16:50.636967 17069b000 Delete type=0 #59
2024/03/05-14:16:50.637141 17069b000 Manual compaction at level-0 from '!adventures!6Gp864ZlopbT97Zy' @ 72057594037927935 : 1 .. '!adventures!6Gp864ZlopbT97Zy' @ 0 : 0; will stop at (end)
25 changes: 14 additions & 11 deletions packs/tinderbox-demo/LOG.old
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
2024/03/05-08:43:52.020372 172af7000 Delete type=3 #1
2024/03/05-08:45:45.048684 173b9b000 Level-0 table #43: started
2024/03/05-08:45:45.048840 173b9b000 Level-0 table #43: 0 bytes OK
2024/03/05-08:45:45.049086 173b9b000 Delete type=0 #41
2024/03/05-08:45:45.050067 173b9b000 Manual compaction at level-0 from '!adventures!6Gp864ZlopbT97Zy' @ 72057594037927935 : 1 .. '!adventures!6Gp864ZlopbT97Zy' @ 0 : 0; will stop at '!adventures!6Gp864ZlopbT97Zy' @ 8 : 1
2024/03/05-08:45:45.050074 173b9b000 Compacting 1@0 + 0@1 files
2024/03/05-08:45:45.051067 173b9b000 Generated table #44@0: 1 keys, 59584 bytes
2024/03/05-08:45:45.051079 173b9b000 Compacted 1@0 + 0@1 files => 59584 bytes
2024/03/05-08:45:45.051141 173b9b000 compacted to: files[ 0 1 0 0 0 0 0 ]
2024/03/05-08:45:45.051188 173b9b000 Delete type=2 #35
2024/03/05-08:45:45.051428 173b9b000 Manual compaction at level-0 from '!adventures!6Gp864ZlopbT97Zy' @ 8 : 1 .. '!adventures!6Gp864ZlopbT97Zy' @ 0 : 0; will stop at (end)
2024/03/05-13:48:56.780950 16f5f7000 Recovering log #51
2024/03/05-13:48:56.781457 16f5f7000 Delete type=3 #49
2024/03/05-13:48:56.781509 16f5f7000 Delete type=0 #51
2024/03/05-14:15:38.366646 17069b000 Level-0 table #56: started
2024/03/05-14:15:38.367968 17069b000 Level-0 table #56: 119474 bytes OK
2024/03/05-14:15:38.368079 17069b000 Delete type=0 #54
2024/03/05-14:15:38.368770 17069b000 Manual compaction at level-0 from '!adventures!6Gp864ZlopbT97Zy' @ 72057594037927935 : 1 .. '!adventures!6Gp864ZlopbT97Zy' @ 0 : 0; will stop at '!adventures!6Gp864ZlopbT97Zy' @ 9 : 1
2024/03/05-14:15:38.368776 17069b000 Compacting 1@0 + 1@1 files
2024/03/05-14:15:38.369815 17069b000 Generated table #57@0: 1 keys, 59945 bytes
2024/03/05-14:15:38.369825 17069b000 Compacted 1@0 + 1@1 files => 59945 bytes
2024/03/05-14:15:38.369878 17069b000 compacted to: files[ 0 1 0 0 0 0 0 ]
2024/03/05-14:15:38.369914 17069b000 Delete type=2 #56
2024/03/05-14:15:38.369975 17069b000 Delete type=2 #44
2024/03/05-14:15:38.370084 17069b000 Manual compaction at level-0 from '!adventures!6Gp864ZlopbT97Zy' @ 9 : 1 .. '!adventures!6Gp864ZlopbT97Zy' @ 0 : 0; will stop at (end)
Binary file removed packs/tinderbox-demo/MANIFEST-000045
Binary file not shown.
Binary file added packs/tinderbox-demo/MANIFEST-000058
Binary file not shown.
14 changes: 14 additions & 0 deletions scripts/apps/dice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const DENOMINATION = "x";

export class DoubleSix extends Die {
constructor(termData) {
super({ ...termData, faces: 12 });
}

static DENOMINATION = "6";

get total() {
const total = super.total;
return Math.ceil(total / 2);
}
}
34 changes: 33 additions & 1 deletion scripts/apps/story-tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,49 @@ export class StoryTagApp extends FormApplication {
width: 500,
height: 600,
resizable: true,

dragDrop: [{ dropSelector: ".actors" }],
});
}

async getData() {
const config = game.settings.get("litm", "storytags");
if (isEmpty(config)) return
const actors = config.actors?.map((id) => game.actors.get(id));

return {
tags: game.settings.get("litm", "storytags"),
};
}

activateListeners(html) {
super.activateListeners(html);

}

async _updateObject(event, formData) {
debugger;
await game.settings.set("litm", "storytags", formData);
}

#createTags(string) {
const tags = CONFIG.litm.tagStringRe.exec(string);
if (!tag) return null;
debugger;
}

#renderTags(tags) {
return tags.map((tag) => {
return `[${tag}]`
})
}

_onDrop(...event) {

debugger;
}

_canDragDrop(...args) {
debugger;
return true;
}
}
2 changes: 1 addition & 1 deletion scripts/item/theme/theme-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class ThemeSheet extends SheetMixin(ItemSheet) {
static defaultOptions = mergeObject(ItemSheet.defaultOptions, {
classes: ["litm", "litm--theme"],
width: 330,
height: 620,
height: 660,
});

get system() {
Expand Down
21 changes: 13 additions & 8 deletions scripts/item/threat/threat-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ export class ThreatSheet extends SheetMixin(ItemSheet) {
return mergeObject(super.defaultOptions, {
classes: ["litm", "litm--threat"],
template: "systems/litm/templates/item/threat.html",
width: 500,
width: 400,
height: 200,
resizable: true,
submitOnChange: true,
});
}

get effects() {
return this.item.effects;
}

get system() {
return this.item.system;
}
Expand Down Expand Up @@ -44,17 +48,18 @@ export class ThreatSheet extends SheetMixin(ItemSheet) {
html.find("[contenteditable]:has(+#consequence)").focus();
}

async _onSubmit(formData, options = {}) {
const res = await super._onSubmit(formData, options);
if (!res['system.consequences']) return res;
async _updateObject(event, formData) {
const res = await super._updateObject(event, formData);

if (!formData['system.consequences.0']) return res;

// Delete existing tags and statuses
await this.item.deleteEmbeddedDocuments("ActiveEffect", this.item.effects.map((e) => e._id));
await this.item.deleteEmbeddedDocuments("ActiveEffect", this.effects.map((e) => e._id));

const matches = res['system.consequences'].flatMap(string => string.matchAll(CONFIG.litm.tagStringRe));
const matches = this.system.consequences.flatMap(string => Array.from(string.matchAll(CONFIG.litm.tagStringRe)));

// Create new tags and statuses
await this.item.createEmbeddedDocuments("ActiveEffect", Array.from(matches.map(([_, tag, status]) => {
await this.item.createEmbeddedDocuments("ActiveEffect", matches.map(([_, tag, status]) => {
const type = status !== undefined ? "status" : "tag";
return {
name: tag,
Expand All @@ -72,7 +77,7 @@ export class ThreatSheet extends SheetMixin(ItemSheet) {
},
],
}
})));
}));
}

#handleClick(event) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/mixins/sheet-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const SheetMixin = (Base) => class extends Base {
#handleInput(event) {
const t = event.currentTarget;
const targetId = t.dataset.input;
const value = t.innerText || t.value;
const value = t.textContent || t.value;
const target = $(t).siblings(`input#${targetId}`);
target.val(value);
}
Expand Down
8 changes: 8 additions & 0 deletions scripts/system/fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { info } from "../logger.js";
export class Fonts {
static register() {
info("Registering Fonts...");
FontConfig.loadFont("LitM Dice", {
fonts: [
{
name: "LitM Dice",
urls: ["systems/litm/assets/fonts/litm-dice.otf"],
}
]
})
FontConfig.loadFont("CaslonAntique", {
editor: true,
fonts: [
Expand Down
36 changes: 31 additions & 5 deletions scripts/system/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class LitmHooks {
LitmHooks.#prepareCharacterOnCreate();
LitmHooks.#prepareThemeOnCreate();
LitmHooks.#listenToContentLinks();
LitmHooks.#customizeDiceSoNice();
LitmHooks.#renderStoryTagApp();
LitmHooks.#rendeWelcomeScreen();
}
Expand Down Expand Up @@ -209,7 +210,7 @@ export class LitmHooks {
actorLink: true,
disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY,
};
actor.updateSource({ prototypeToken, img });
actor.updateSource({ prototypeToken });
});

Hooks.on("createActor", async (actor) => {
Expand Down Expand Up @@ -238,10 +239,10 @@ export class LitmHooks {
}

static #renderStoryTagApp() {
// Hooks.once("ready", () => {
// const app = new game.litm.StoryTagApp();
// app.render(true);
// });
Hooks.once("ready", () => {
const app = new game.litm.StoryTagApp();
// app.render(true);
});
}

static #listenToContentLinks() {
Expand All @@ -260,6 +261,31 @@ export class LitmHooks {
});
}

static #customizeDiceSoNice() {
Hooks.on("diceSoNiceReady", (dice3d) => {
dice3d.addSystem({ id: "litm", name: "Legend in the Mist" }, "preferred");
dice3d.addDicePreset({
type: "d6",
labels: ["1", "2", "3", "4", "5", "6", "1", "2", "3", "4", "5", "6"],
font: "LitM Dice",
system: "litm",
}, "d12");


dice3d.addColorset({
name: 'litm',
description: "Legend in the Mist Default",
category: "Legend in the Mist",
foreground: '#ffffff',
background: "#708768",
texture: 'stone',
material: 'stone',
font: 'Georgia',
visibility: 'visible'
}, "preferred");

});
}
static #rendeWelcomeScreen() {
Hooks.once("ready", async () => {
let scene = game.scenes.getName("Legend in the Mist");
Expand Down
1 change: 0 additions & 1 deletion styles/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
border-top: 1.5px solid rgb(0, 0, 0, 0.4);
background-color: transparent;
color: var(--litm-color);
-webkit-font-smoothing: auto;
font-size: var(--font-size-20);
font-family: var(--litm-font-accent);
transition: all 0.15s;
Expand Down
6 changes: 3 additions & 3 deletions styles/item/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,14 @@
margin: 0px 1.55rem 1rem;
background-image: radial-gradient(#999 -150%, transparent 70%);
color: var(--litm-color-primary-bg);
-webkit-font-smoothing: none;
-webkit-font-smoothing: antialiased;
font-family: var(--litm-font-text);
font-size: var(--font-size-12);
font-size: var(--font-size-14);
letter-spacing: 1px;
text-align: center;
line-height: 1.45;

[role="application"] {
& [role="application"] {
height: 100% !important
}
}
Expand Down
12 changes: 6 additions & 6 deletions styles/item/threat.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
font-family: var(--litm-font-text);
font-size: var(--font-size-16);

header {
& header {
color: var(--litm-color-primary);
}

form {
& form {
color: var(--litm-color-primary);
padding: 0px var(--litm-space-2);
}

h2 {
& h2 {
text-align: center;
border: none;
font-family: var(--litm-font-accent);
}

.litm--threat-wrapper {
& .litm--threat-wrapper {
display: flex;
flex-direction: column;
gap: var(--litm-space-2);
padding-inline-start: var(--litm-space-3);
list-style: none;

li {
& li {
display: flex;
gap: var(--litm-space-1);
}
Expand All @@ -49,7 +49,7 @@
font-style: italic;
}

[id^=consequence-] {
& [id^=consequence-] {
font-weight: 500;
min-width: 50px;

Expand Down
2 changes: 1 addition & 1 deletion templates/apps/story-tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2>{{concat (localize "Litm.tags.story") " " (localize "Litm.other.tags")}}</h2

</fieldset>
<hr>
<fieldset>
<fieldset class="actors">

</fieldset>
<hr>
Expand Down

0 comments on commit 1bfe434

Please sign in to comment.