Initial system development

This commit is contained in:
sladecraven 2021-01-18 16:11:27 +01:00
parent 0699b05806
commit 199dc4c6ed
64 changed files with 513 additions and 4 deletions

BIN
img/cards/c01.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
img/cards/c02.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
img/cards/c03.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
img/cards/c04.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
img/cards/c05.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

BIN
img/cards/c06.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/cards/c07.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
img/cards/c08.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/cards/c09.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/cards/c10.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/cards/c11.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
img/cards/c12.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
img/cards/c13.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
img/cards/card_back.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
img/cards/d01.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
img/cards/d02.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
img/cards/d03.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
img/cards/d04.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

BIN
img/cards/d05.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
img/cards/d06.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/cards/d07.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/cards/d08.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/cards/d09.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
img/cards/d10.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
img/cards/d11.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
img/cards/d12.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
img/cards/d13.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
img/cards/h01.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
img/cards/h02.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

BIN
img/cards/h03.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
img/cards/h04.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

BIN
img/cards/h05.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/cards/h06.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/cards/h07.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/cards/h08.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
img/cards/h09.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
img/cards/h10.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
img/cards/h11.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
img/cards/h12.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
img/cards/h13.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
img/cards/jb.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
img/cards/jr.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
img/cards/s01.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
img/cards/s02.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
img/cards/s03.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
img/cards/s04.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
img/cards/s05.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
img/cards/s06.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
img/cards/s07.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

BIN
img/cards/s08.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
img/cards/s09.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
img/cards/s10.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
img/cards/s11.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
img/cards/s12.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
img/cards/s13.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

76
module/actor-sheet.js Normal file
View File

@ -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);
}
}

75
module/item-sheet.js Normal file
View File

@ -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);
}
}

48
module/sos-card-deck.js Normal file
View File

@ -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;
}
}
}

View File

@ -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 */

View File

@ -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'
]
}

View File

@ -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,

130
templates/actor-sheet.html Normal file
View File

@ -0,0 +1,130 @@
{{log "handlebar actor-sheet" this}}
<form class="{{cssClass}}" autocomplete="off">
{{!-- Sheet Header --}}
<header class="sheet-header">
<div class="header-fields">
<div class="flexrow">
<img class="profile-img" src="{{actor.img}}" data-edit="img" title="{{actor.name}}" />
<h1 class="charname"><input name="name" type="text" value="{{actor.name}}" placeholder="Name"/></h1>
</div>
</div>
</header>
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="stats">Stats</a>
<a class="item" data-tab="skills">Skills</a>
<a class="item" data-tab="fight">Fight</a>
<a class="item" data-tab="gears">Gears</a>
<a class="item" data-tab="description">Description</a>
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- Carac Tab --}}
<div class="tab items" data-group="primary" data-tab="stats">
<div class="grid grid-2col">
<div class="flex-group-left flexcol">
<span><a class="lock-unlock-sheet"><img class="small-button-container"
src="systems/foundryvtt-shadows-over-sol/img/icons/{{#if data.editStatSkill}}unlocked.svg{{else}}locked.svg{{/if}}" alt="lock/unlock"
>{{#if data.editStatSkill}}Lock{{else}}Unlock{{/if}}</a></span>
<ul class="stat-list alternate-list">
{{#each data.stats as |stat key|}}
{{#if stat.isLevelUp}}
<li class="stat flexrow xp-level-up" data-attribute="{{key}}">
<span class="stat-label flexrow tooltip tooltip-nobottom" name="data.stat.{{key}}.label">
<span class="tooltiptext ttt-xp">
{{localize STAT.levelUp}}
</span>
{{else}}
<li class="stat flexrow list-item" data-attribute="{{key}}">
{{/if}}
<a name={{key}}>{{stat.label}}</a></span>
<input class="stat-value flexrow" type="text" name="data.stat.{{key}}.value" value="{{stat.value}}" data-dtype="Number" {{#unless @root.data.editStatSkill}}disabled{{/unless}} />
<input class="stat-xp flexrow" type="text" name="data.stat.{{key}}.xp" value="{{stat.xp}}" data-dtype="Number" {{#unless @root.data.editStatSkill}}disabled{{/unless}} />
</li>
{{/each}}
</ul>
</div>
</div>
</div>
{{!-- Skills Tab --}}
<div class="tab skills" data-group="primary" data-tab="skills">
<div class="flexrow">
<span><a class="lock-unlock-sheet"><img class="small-button-container"
src="systems/foundryvtt-shadows-over-sol/img/icons/{{#if data.editStatSkill}}unlocked.svg{{else}}locked.svg{{/if}}" alt="lock/unlock"
>{{#if data.editStatSkill}}Lock{{else}}Unlock{{/if}}</a></span>
</div>
</div>
{{!-- Fight Tab --}}
<div class="tab fight" data-group="primary" data-tab="fight">
<ul class="item-list alternate-list">
</ul>
</div>
{{!-- Gears Tab --}}
<div class="tab gears" data-group="primary" data-tab="gears">
<div class="flex-group-left flexcol competence-column">
</div>
</div>
{{!-- Biography Tab --}}
<div class="tab biography" data-group="primary" data-tab="description">
<article class="flexrow">
<ul class="item-list alternate-list">
<li class="item flexrow list-item">
<label class="description-label stat-label">Genre :
<input class="description-value flexrow" type="text" name="data.sex" value="{{data.sex}}" data-dtype="String"/>
</label>
</li>
<li class="item flexrow list-item">
<label class="description-label stat-label">Weight :
<input class="description-value flexrow" type="text" name="data.weight" value="{{data.weight}}" data-dtype="String"/>
</label>
</li>
<li class="item flexrow list-item">
<label class="description-label competence-label">Size :
<input class="description-value flexrow" type="text" name="data.taille" value="{{data.taille}}" data-dtype="String"/>
</label>
</li>
<li class="item flexrow list-item">
<label class="description-label competence-label">Hair :
<input class="description-value flexrow" type="text" name="data.hair" value="{{data.hair}}" data-dtype="String"/>
</label>
</li>
<li class="item flexrow list-item">
<label class="description-label competence-label">Eyes :
<input class="description-value flexrow" type="text" name="data.eyes" value="{{data.eyes}}" data-dtype="String"/>
</label>
</li>
</ul>
<ul class="item-list alterne-list">
<li class="item flexrow list-item">
<label class="description-label competence-label">Age :
<input class="description-value flexrow" type="text" name="data.age" value="{{data.age}}" data-dtype="String"/>
</label>
</li>
</ul>
</article>
<article class="flexcol">
<h3>Biography : </h3>
<div class="form-group editor">
{{editor content=data.biography target="data.biography" button=true owner=owner editable=editable}}
</div>
<h3>Notes : </h3>
<div class="form-group editor">
{{editor content=data.notes target="data.notes" button=true owner=owner editable=editable}}
</div>
{{>"systems/foundryvtt-shadows-over-sol/templates/editor-notes-gm.html"}}
</article>
</div>
</section>
</form>

View File

@ -0,0 +1,6 @@
{{#if data.isGM}}
<h3>GM Notes : </h3>
<div class="form-group editor">
{{editor content=data.gmnotes target="data.gmnotes" button=true owner=owner editable=editable}}
</div>
{{/if}}

64
templates/item-sheet.html Normal file
View File

@ -0,0 +1,64 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{item.name}}" placeholder="Name"/></h1>
<div class="resource">
<label>Quantity</label>
<input type="text" name="data.quantity" value="{{data.quantity}}" data-dtype="Number"/>
</div>
<div class="resource">
<label>Weight</label>
<input type="text" name="data.weight" value="{{data.weight}}" data-dtype="Number"/>
</div>
</div>
</header>
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="description">Description</a>
<a class="item" data-tab="attributes">Attributes</a>
</nav>
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- Description Tab --}}
<div class="tab" data-group="primary" data-tab="description">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
{{!-- Attributes Tab --}}
<div class="tab attributes" data-group="primary" data-tab="attributes">
<header class="attributes-header flexrow">
<span class="attribute-key">Attribute Key</span>
<span class="attribute-value">Value</span>
<span class="attribute-label">Label</span>
<span class="attribute-dtype">Data Type</span>
<a class="attribute-control" data-action="create"><i class="fas fa-plus"></i></a>
</header>
<ol class="attributes-list">
{{#each data.attributes as |attr key|}}
<li class="attribute flexrow" data-attribute="{{key}}">
<input class="attribute-key" type="text" name="data.attributes.{{key}}.key" value="{{key}}"/>
{{#if attr.isCheckbox}}
<label class="attribute-value checkbox"><input type="checkbox" name="data.attributes.{{key}}.value" {{checked attr.value}}/></label>
{{else}}
<input class="attribute-value" type="text" name="data.attributes.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.dtype}}"/>
{{/if}}
<input class="attribute-label" type="text" name="data.attributes.{{key}}.label" value="{{attr.label}}"/>
<select class="attribute-dtype" name="data.attributes.{{key}}.dtype">
{{#select attr.dtype}}
{{#each ../dtypes as |t|}}
<option value="{{t}}">{{t}}</option>
{{/each}}
{{/select}}
</select>
<a class="attribute-control" data-action="delete"><i class="fas fa-trash"></i></a>
</li>
{{/each}}
</ol>
</div>
</section>
</form>