diff --git a/img/cards/c01.webp b/img/cards/c01.webp new file mode 100644 index 0000000..1a165c8 Binary files /dev/null and b/img/cards/c01.webp differ diff --git a/img/cards/c02.webp b/img/cards/c02.webp new file mode 100644 index 0000000..5e78634 Binary files /dev/null and b/img/cards/c02.webp differ diff --git a/img/cards/c03.webp b/img/cards/c03.webp new file mode 100644 index 0000000..5b72900 Binary files /dev/null and b/img/cards/c03.webp differ diff --git a/img/cards/c04.webp b/img/cards/c04.webp new file mode 100644 index 0000000..e3e4163 Binary files /dev/null and b/img/cards/c04.webp differ diff --git a/img/cards/c05.webp b/img/cards/c05.webp new file mode 100644 index 0000000..3800c85 Binary files /dev/null and b/img/cards/c05.webp differ diff --git a/img/cards/c06.webp b/img/cards/c06.webp new file mode 100644 index 0000000..f98a2e6 Binary files /dev/null and b/img/cards/c06.webp differ diff --git a/img/cards/c07.webp b/img/cards/c07.webp new file mode 100644 index 0000000..ab9c9b6 Binary files /dev/null and b/img/cards/c07.webp differ diff --git a/img/cards/c08.webp b/img/cards/c08.webp new file mode 100644 index 0000000..9eb24d0 Binary files /dev/null and b/img/cards/c08.webp differ diff --git a/img/cards/c09.webp b/img/cards/c09.webp new file mode 100644 index 0000000..44b244d Binary files /dev/null and b/img/cards/c09.webp differ diff --git a/img/cards/c10.webp b/img/cards/c10.webp new file mode 100644 index 0000000..618013e Binary files /dev/null and b/img/cards/c10.webp differ diff --git a/img/cards/c11.webp b/img/cards/c11.webp new file mode 100644 index 0000000..4fe75d5 Binary files /dev/null and b/img/cards/c11.webp differ diff --git a/img/cards/c12.webp b/img/cards/c12.webp new file mode 100644 index 0000000..744317f Binary files /dev/null and b/img/cards/c12.webp differ diff --git a/img/cards/c13.webp b/img/cards/c13.webp new file mode 100644 index 0000000..67518c5 Binary files /dev/null and b/img/cards/c13.webp differ diff --git a/img/cards/card_back.webp b/img/cards/card_back.webp new file mode 100644 index 0000000..eea9664 Binary files /dev/null and b/img/cards/card_back.webp differ diff --git a/img/cards/d01.webp b/img/cards/d01.webp new file mode 100644 index 0000000..e25e5a3 Binary files /dev/null and b/img/cards/d01.webp differ diff --git a/img/cards/d02.webp b/img/cards/d02.webp new file mode 100644 index 0000000..0a0d8b7 Binary files /dev/null and b/img/cards/d02.webp differ diff --git a/img/cards/d03.webp b/img/cards/d03.webp new file mode 100644 index 0000000..eb0e904 Binary files /dev/null and b/img/cards/d03.webp differ diff --git a/img/cards/d04.webp b/img/cards/d04.webp new file mode 100644 index 0000000..c4788b7 Binary files /dev/null and b/img/cards/d04.webp differ diff --git a/img/cards/d05.webp b/img/cards/d05.webp new file mode 100644 index 0000000..43f916e Binary files /dev/null and b/img/cards/d05.webp differ diff --git a/img/cards/d06.webp b/img/cards/d06.webp new file mode 100644 index 0000000..47af6e5 Binary files /dev/null and b/img/cards/d06.webp differ diff --git a/img/cards/d07.webp b/img/cards/d07.webp new file mode 100644 index 0000000..2f52be5 Binary files /dev/null and b/img/cards/d07.webp differ diff --git a/img/cards/d08.webp b/img/cards/d08.webp new file mode 100644 index 0000000..bd99624 Binary files /dev/null and b/img/cards/d08.webp differ diff --git a/img/cards/d09.webp b/img/cards/d09.webp new file mode 100644 index 0000000..1194b79 Binary files /dev/null and b/img/cards/d09.webp differ diff --git a/img/cards/d10.webp b/img/cards/d10.webp new file mode 100644 index 0000000..9d87b5b Binary files /dev/null and b/img/cards/d10.webp differ diff --git a/img/cards/d11.webp b/img/cards/d11.webp new file mode 100644 index 0000000..37503ad Binary files /dev/null and b/img/cards/d11.webp differ diff --git a/img/cards/d12.webp b/img/cards/d12.webp new file mode 100644 index 0000000..2852547 Binary files /dev/null and b/img/cards/d12.webp differ diff --git a/img/cards/d13.webp b/img/cards/d13.webp new file mode 100644 index 0000000..adda3f8 Binary files /dev/null and b/img/cards/d13.webp differ diff --git a/img/cards/h01.webp b/img/cards/h01.webp new file mode 100644 index 0000000..06f0887 Binary files /dev/null and b/img/cards/h01.webp differ diff --git a/img/cards/h02.webp b/img/cards/h02.webp new file mode 100644 index 0000000..e6d502c Binary files /dev/null and b/img/cards/h02.webp differ diff --git a/img/cards/h03.webp b/img/cards/h03.webp new file mode 100644 index 0000000..07c2e7e Binary files /dev/null and b/img/cards/h03.webp differ diff --git a/img/cards/h04.webp b/img/cards/h04.webp new file mode 100644 index 0000000..8bf1a69 Binary files /dev/null and b/img/cards/h04.webp differ diff --git a/img/cards/h05.webp b/img/cards/h05.webp new file mode 100644 index 0000000..aa8f083 Binary files /dev/null and b/img/cards/h05.webp differ diff --git a/img/cards/h06.webp b/img/cards/h06.webp new file mode 100644 index 0000000..c81dcd3 Binary files /dev/null and b/img/cards/h06.webp differ diff --git a/img/cards/h07.webp b/img/cards/h07.webp new file mode 100644 index 0000000..82fd29e Binary files /dev/null and b/img/cards/h07.webp differ diff --git a/img/cards/h08.webp b/img/cards/h08.webp new file mode 100644 index 0000000..c0bf12c Binary files /dev/null and b/img/cards/h08.webp differ diff --git a/img/cards/h09.webp b/img/cards/h09.webp new file mode 100644 index 0000000..373b379 Binary files /dev/null and b/img/cards/h09.webp differ diff --git a/img/cards/h10.webp b/img/cards/h10.webp new file mode 100644 index 0000000..a6ba509 Binary files /dev/null and b/img/cards/h10.webp differ diff --git a/img/cards/h11.webp b/img/cards/h11.webp new file mode 100644 index 0000000..66c2819 Binary files /dev/null and b/img/cards/h11.webp differ diff --git a/img/cards/h12.webp b/img/cards/h12.webp new file mode 100644 index 0000000..d6d00ba Binary files /dev/null and b/img/cards/h12.webp differ diff --git a/img/cards/h13.webp b/img/cards/h13.webp new file mode 100644 index 0000000..96bf086 Binary files /dev/null and b/img/cards/h13.webp differ diff --git a/img/cards/jb.webp b/img/cards/jb.webp new file mode 100644 index 0000000..d2341c9 Binary files /dev/null and b/img/cards/jb.webp differ diff --git a/img/cards/jr.webp b/img/cards/jr.webp new file mode 100644 index 0000000..b5f9cc8 Binary files /dev/null and b/img/cards/jr.webp differ diff --git a/img/cards/s01.webp b/img/cards/s01.webp new file mode 100644 index 0000000..a93d93c Binary files /dev/null and b/img/cards/s01.webp differ diff --git a/img/cards/s02.webp b/img/cards/s02.webp new file mode 100644 index 0000000..d47079f Binary files /dev/null and b/img/cards/s02.webp differ diff --git a/img/cards/s03.webp b/img/cards/s03.webp new file mode 100644 index 0000000..d90af61 Binary files /dev/null and b/img/cards/s03.webp differ diff --git a/img/cards/s04.webp b/img/cards/s04.webp new file mode 100644 index 0000000..0dfdc0b Binary files /dev/null and b/img/cards/s04.webp differ diff --git a/img/cards/s05.webp b/img/cards/s05.webp new file mode 100644 index 0000000..6bf9efd Binary files /dev/null and b/img/cards/s05.webp differ diff --git a/img/cards/s06.webp b/img/cards/s06.webp new file mode 100644 index 0000000..aaa4db5 Binary files /dev/null and b/img/cards/s06.webp differ diff --git a/img/cards/s07.webp b/img/cards/s07.webp new file mode 100644 index 0000000..020cdd7 Binary files /dev/null and b/img/cards/s07.webp differ diff --git a/img/cards/s08.webp b/img/cards/s08.webp new file mode 100644 index 0000000..2b367fe Binary files /dev/null and b/img/cards/s08.webp differ diff --git a/img/cards/s09.webp b/img/cards/s09.webp new file mode 100644 index 0000000..4e382b2 Binary files /dev/null and b/img/cards/s09.webp differ diff --git a/img/cards/s10.webp b/img/cards/s10.webp new file mode 100644 index 0000000..2a89a62 Binary files /dev/null and b/img/cards/s10.webp differ diff --git a/img/cards/s11.webp b/img/cards/s11.webp new file mode 100644 index 0000000..39da111 Binary files /dev/null and b/img/cards/s11.webp differ diff --git a/img/cards/s12.webp b/img/cards/s12.webp new file mode 100644 index 0000000..8a302ee Binary files /dev/null and b/img/cards/s12.webp differ diff --git a/img/cards/s13.webp b/img/cards/s13.webp new file mode 100644 index 0000000..1cfd089 Binary files /dev/null and b/img/cards/s13.webp differ diff --git a/module/actor-sheet.js b/module/actor-sheet.js new file mode 100644 index 0000000..97d1bea --- /dev/null +++ b/module/actor-sheet.js @@ -0,0 +1,76 @@ +/** + * Extend the basic ActorSheet with some very simple modifications + * @extends {ActorSheet} + */ + +import { SoSUtility } from "./sos-utility.js"; + +/* -------------------------------------------- */ +export class SoSActorSheet extends ActorSheet { + + /** @override */ + static get defaultOptions() { + return mergeObject(super.defaultOptions, { + classes: ["sos", "sheet", "actor"], + template: "systems/foundryvtt-shadows-over-sol/templates/actor-sheet.html", + width: 640, + //height: 720, + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats" }], + dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }] + }); + } + + /* -------------------------------------------- */ + getData() { + let data = super.getData(); + + return data; + } + + /* -------------------------------------------- */ + async _onDrop(event) { + super._onDrop(event); + } + + /* -------------------------------------------- */ + /** @override */ + activateListeners(html) { + super.activateListeners(html); + + HtmlUtility._showControlWhen($(".gm-only"), game.user.isGM); + + // Everything below here is only needed if the sheet is editable + if (!this.options.editable) return; + + // Update Inventory Item + html.find('.item-edit').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + const item = this.actor.getOwnedItem(li.data("item-id")); + item.sheet.render(true); + }); + + // Delete Inventory Item + html.find('.item-delete').click(ev => { + const li = $(ev.currentTarget).parents(".item"); + RdDUtility.confirmerSuppression(this, li); + }); + } + + /* -------------------------------------------- */ + /** @override */ + setPosition(options = {}) { + const position = super.setPosition(options); + const sheetBody = this.element.find(".sheet-body"); + const bodyHeight = position.height - 192; + sheetBody.css("height", bodyHeight); + return position; + } + + + /* -------------------------------------------- */ + /** @override */ + _updateObject(event, formData) { + // Update the Actor + return this.object.update(formData); + } +} diff --git a/module/item-sheet.js b/module/item-sheet.js new file mode 100644 index 0000000..c480b1a --- /dev/null +++ b/module/item-sheet.js @@ -0,0 +1,75 @@ +import { SoSUtility } from "./sos-utility.js"; + +/** + * Extend the basic ItemSheet with some very simple modifications + * @extends {ItemSheet} + */ +export class SoSItemSheet extends ItemSheet { + + /** @override */ + static get defaultOptions() { + return mergeObject(super.defaultOptions, { + classes: ["foundryvtt-shadows-over-sol", "sheet", "item"], + template: "systems/foundryvtt-shadows-over-sol/templates/item-sheet.html", + width: 550, + height: 550 + //tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}] + }); + } + + /* -------------------------------------------- */ + _getHeaderButtons() { + let buttons = super._getHeaderButtons(); + // Add "Post to chat" button + // We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry! + buttons.unshift( + { + class: "post", + icon: "fas fa-comment", + onclick: ev => {} //new RdDItem(this.item.data).postItem() + }) + return buttons + } + + /* -------------------------------------------- */ + /** @override */ + setPosition(options={}) { + const position = super.setPosition(options); + const sheetBody = this.element.find(".sheet-body"); + const bodyHeight = position.height - 192; + sheetBody.css("height", bodyHeight); + return position; + } + + /* -------------------------------------------- */ + async getData() { + let data = super.getData(); + data.isGM = game.user.isGM; + + return data; + } + + /* -------------------------------------------- */ + /** @override */ + activateListeners(html) { + super.activateListeners(html); + + // Everything below here is only needed if the sheet is editable + if (!this.options.editable) return; + + + } + + /* -------------------------------------------- */ + get template() + { + let type = this.item.type; + return `systems/foundryvtt-shadows-over-sol/templates/item-${type}-sheet.html`; + } + + /* -------------------------------------------- */ + /** @override */ + _updateObject(event, formData) { + return this.object.update(formData); + } +} diff --git a/module/sos-card-deck.js b/module/sos-card-deck.js new file mode 100644 index 0000000..f055211 --- /dev/null +++ b/module/sos-card-deck.js @@ -0,0 +1,48 @@ + +/* -------------------------------------------- */ +const NB_POKER_CARD = 54; +const IDX2CARDFAMILY = ['c', 'd', 'h', 's']; + +/* -------------------------------------------- */ +export class SoSCardDeck extends Application { + + /* -------------------------------------------- */ + static async create(data, options) { + data.deck = []; + data.discard = []; + data.cardState = []; + + return super.create(data, options); + } + + /* -------------------------------------------- */ + shuffleDeck() { + this.cleanCardList(); + // Randomize deck + while (data.deck.length != NB_POKER_CARD) { + let idx = new Roll("1d54").roll().total; + if (!this.data.cardState[idx - 1]) { + if (idx == 53) { // Red Joker + data.deck.push = { cardName: 'jr' } + } else if (idx == 54) { // Black Joker + data.deck.push = { cardName: 'jb' } + } else { + let familyIdx = idx % 4; + let cardName = IDX2CARDFAMILY[familyIdx] + String((idx % 13) + 1); + data.deck.push = { cardName: cardName } + } + this.data.cardState[idx - 1] = true; + } + } + } + + /* -------------------------------------------- */ + cleanCardList() { + data.discard = []; // Reinit discard pile + data.deck = []; + for (let i = 0; i < NB_POKER_CARD; i++) { + data.cardState[i] = false; + } + } + +} \ No newline at end of file diff --git a/module/sos-main.js b/module/sos-main.js index 2d3f638..7bbfc76 100644 --- a/module/sos-main.js +++ b/module/sos-main.js @@ -12,8 +12,8 @@ import { SoSActor } from "./actor.js"; import { SoSItemSheet } from "./item-sheet.js"; import { SoSActorSheet } from "./actor-sheet.js"; import { SoSUtility } from "./rdd-utility.js"; -import { SoSTokenHud } from "./rdd-token-hud.js"; -import { SoSCommands } from "./rdd-commands.js"; +//import { SoSTokenHud } from "./rdd-token-hud.js"; +//import { SoSCommands } from "./rdd-commands.js"; /* -------------------------------------------- */ /* Foundry VTT Initialization */ diff --git a/module/sos-utility.js b/module/sos-utility.js index 362631a..ee8ae73 100644 --- a/module/sos-utility.js +++ b/module/sos-utility.js @@ -1,8 +1,12 @@ export class SoSUtility { - /* -------------------------------------------- */ + + /* -------------------------------------------- */ static async preloadHandlebarsTemplates() { const templatePaths = [ + 'systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html', + 'systems/foundryvtt-reve-de-dragon/templates/editor-notes-gm.html', + 'systems/foundryvtt-reve-de-dragon/templates/item-shet.html' ] } diff --git a/template.json b/template.json index 915370f..4089670 100644 --- a/template.json +++ b/template.json @@ -13,7 +13,102 @@ "vehicules": [] } }, + "common": { + "stats": { + "strength": { + "value": 0, + "cardsuit": "spade", + "group": "STATS.physical", + "label": "STATS.strength", + "xp": 0 + }, + "dexterity": { + "value": 0, + "cardsuit": "hearth", + "group": "STATS.physical", + "label": "STATS.dexterity", + "xp": 0 + }, + "speed": { + "value": 0, + "cardsuit": "diamond", + "group": "STATS.physical", + "label": "STATS.speed", + "xp": 0 + }, + "endurance": { + "value": 0, + "cardsuit": "club", + "group": "STATS.physical", + "label": "STATS.endurance", + "xp": 0 + }, + "intelligence": { + "value": 0, + "cardsuit": "spade", + "group": "STATS.mental", + "label": "STATS.intelligence", + "xp": 0 + }, + "perception": { + "value": 0, + "cardsuit": "hearth", + "group": "STATS.mental", + "label": "STATS.perception", + "xp": 0 + }, + "charisma": { + "value": 0, + "cardsuit": "diamond", + "group": "STATS.mental", + "label": "STATS.charisma", + "xp": 0 + }, + "determination": { + "value": 0, + "cardsuit": "club", + "group": "STATS.mental", + "label": "STATS.determination", + "xp": 0 + } + }, + "internals": { + "deck": [] + }, + "scores": { + "edge": { + "value": 0 + }, + "wealth": { + "value": 0 + }, + "lifestyle": { + "value": 0 + }, + "defense": { + "value1": 0, + "value2": 0 + }, + "dr": { + "value": 0 + }, + "shock": { + "value": 0 + }, + "totalwounds": { + "value": 0 + }, + "wound": { + "value": 0 + }, + "encumbrance": { + "value": 0 + } + } + }, "background": { + "geneline": "", + "subculture": "", "history": "", "notes": "Notes", "gmnotes": "GM notes", @@ -21,6 +116,7 @@ "hair": "", "weight": "", "sex": "", + "corp": "", "age": 0 }, "personnage": { @@ -31,7 +127,17 @@ } }, "Item": { - "types": ["object", "weapon", "armor", "container" ], + "types": ["object", "weapon", "armor", "container", "skills" ], + "skills": { + "stat":"", + "value": 0, + "xp": 0, + "description": "" + }, + "skillexperience": { + "skillname": "", + "description": "" + }, "object": { "description": "", "quantity": 1, diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html new file mode 100644 index 0000000..895c266 --- /dev/null +++ b/templates/actor-sheet.html @@ -0,0 +1,130 @@ +{{log "handlebar actor-sheet" this}} +
+ + {{!-- Sheet Header --}} +
+
+
+ +

+
+
+
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+ + {{!-- Carac Tab --}} +
+
+
+ lock/unlock{{#if data.editStatSkill}}Lock{{else}}Unlock{{/if}} +
    + {{#each data.stats as |stat key|}} + {{#if stat.isLevelUp}} +
  • + + + {{localize STAT.levelUp}} + + {{else}} +
  • + {{/if}} + {{stat.label}} + + +
  • + {{/each}} +
+
+
+
+ + {{!-- Skills Tab --}} + + + {{!-- Fight Tab --}} +
+
    +
+
+ + {{!-- Gears Tab --}} +
+
+
+
+ + + {{!-- Biography Tab --}} +
+
+
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
    +
  • + +
  • +
+
+ +
+

Biography :

+
+ {{editor content=data.biography target="data.biography" button=true owner=owner editable=editable}} +
+

Notes :

+
+ {{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}} +
+ {{>"systems/foundryvtt-shadows-over-sol/templates/editor-notes-gm.html"}} +
+
+ +
+
+ diff --git a/templates/editor-notes-gm.html b/templates/editor-notes-gm.html new file mode 100644 index 0000000..f3b3218 --- /dev/null +++ b/templates/editor-notes-gm.html @@ -0,0 +1,6 @@ +{{#if data.isGM}} +

GM Notes :

+
+ {{editor content=data.gmnotes target="data.gmnotes" button=true owner=owner editable=editable}} +
+{{/if}} diff --git a/templates/item-sheet.html b/templates/item-sheet.html new file mode 100644 index 0000000..c8acc8e --- /dev/null +++ b/templates/item-sheet.html @@ -0,0 +1,64 @@ +
+
+ +
+

+
+ + +
+
+ + +
+
+
+ + {{!-- Sheet Tab Navigation --}} + + + {{!-- Sheet Body --}} +
+ + {{!-- Description Tab --}} +
+ {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} +
+ + {{!-- Attributes Tab --}} +
+
+ Attribute Key + Value + Label + Data Type + +
+ +
    + {{#each data.attributes as |attr key|}} +
  1. + + {{#if attr.isCheckbox}} + + {{else}} + + {{/if}} + + + +
  2. + {{/each}} +
+
+
+