This commit is contained in:
François-Xavier Guillois
2023-09-06 17:18:58 +02:00
parent c19a351622
commit 55c3d09490
14 changed files with 107 additions and 64 deletions
+2
View File
@@ -4,6 +4,8 @@
- versions condensées des méthodes (@kristov)
- renommage des templates
- image actors par défaut
- image des créatures
- ajout du totem et de l'apprentissage dans les capacités
## 0.1.8
- refactoring sheet vers actor
+3 -1
View File
@@ -164,6 +164,7 @@
"type_character": "Personnage",
"type_npc": "PNJ",
"type_creature": "Créature",
"type": "Type",
"group_members": "Membres",
"encounters": "Rencontres",
"road": "La Route",
@@ -209,7 +210,8 @@
"evolutions": "Adaptations",
"new_vehicle": "Nouveau véhicule",
"vehicles": "Véhicules",
"new_objective": "Nouvel objectif"
"new_objective": "Nouvel objectif",
"learning": "Apprentissage"
},
"ABILITIES": {
"vigor": { "name": "Vigueur"},
+18
View File
@@ -11,6 +11,24 @@ export class VermineItem extends Item {
// preparation methods overridden (such as prepareBaseData()).
super.prepareData();
}
prepareBaseData(){
const actorType = (this.actor !== null) ? this.actor.type : 'character';
switch (this.type){
case 'ability':
if (this.system.type == "") {
// console.log('je suis une capacité, avec pour sous-type', this.system.type, actorType);
this.system.type = actorType;
}
if (this.system.totem == "" && this.actor !== null && this.actor.system.identity.totem != "") {
// console.log('je suis une capacité, avec pour sous-type', this.system.type, actorType);
this.system.totem = this.actor.system.identity.totem;
}
break;
default:
break;
}
}
/**
* Prepare a data object which is passed to any Roll formulas which are created related to this Item
+2 -2
View File
@@ -9,12 +9,12 @@ export class VermineActorSheet extends ActorSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["vermine2047", "sheet", "actor"],
/*classes: ["vermine2047", "sheet", "actor"],
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
height: 800,
width: 690,
resizable: false,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]*/
});
}
+1 -1
View File
@@ -12,7 +12,7 @@ export class VermineCharacterSheet extends VermineActorSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["vermine2047", "sheet", "actor"],
classes: ["vermine2047", "sheet", "character", "actor"],
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
width: 600,
height: 600,
+30 -3
View File
@@ -10,10 +10,10 @@ export class VermineCreatureSheet extends ActorSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["vermine2047", "sheet", "actor"],
classes: ["vermine2047", "sheet", "actor", "creature"],
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
width: 600,
height: 600,
width: 300,
height: 300,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
});
}
@@ -92,6 +92,33 @@ export class VermineCreatureSheet extends ActorSheet {
/** @override */
activateListeners(html) {
super.activateListeners(html);
html.find('.item-create').click(this._onItemCreate.bind(this));
}
async _onItemCreate(event) {
event.preventDefault();
const header = event.currentTarget;
// Get the type of item to create.
const type = header.dataset.type;
// Grab any data associated with this control.
const data = duplicate(header.dataset);
// Initialize a default name.
// const name = `New ${type.capitalize()}`;
const name = game.i18n.localize('ITEMS.new_' + type);
console.log('onItemCreate child', data.type, this.actor.type);
// Prepare the item object.
const itemData = {
name: name,
type: type,
system: data
};
// Remove the type from the dataset since it's in the itemData.type prop.
delete itemData.system["type"];
// Finally, create the item!
return await Item.create(itemData, {parent: this.actor});
}
}
+1
View File
@@ -45,6 +45,7 @@ export class VermineItemSheet extends ItemSheet {
// Add the actor's data to context.data for easier access, as well as flags.
context.system = itemData.system;
context.flags = itemData.flags;
context.config = CONFIG.VERMINE;
return context;
}
+13 -42
View File
@@ -11,10 +11,10 @@ export class VermineGroupSheet extends VermineActorSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["vermine2047", "sheet", "actor"],
classes: ["vermine2047", "sheet", "actor", "group"],
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
width: 600,
height: 600,
width: 500,
height: 500,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
});
}
@@ -88,41 +88,19 @@ export class VermineGroupSheet extends VermineActorSheet {
* @return {undefined}
*/
_prepareItems(context) {
// Initialize containers.
const abilities = [];
const specialties = [];
const backgrounds = [];
const evolutions = [];
const traumas = [];
context.specialties = this.actor.itemTypes['specialty'];
context.backgrounds = this.actor.itemTypes['background'];
context.evolutions = this.actor.itemTypes['evolution'];
context.traumas = this.actor.itemTypes['trauma'];
context.gear = this.actor.itemTypes['item'];
context.weapons = this.actor.itemTypes['weapon'];
context.defenses = this.actor.itemTypes['defense'];
context.vehicles = this.actor.itemTypes['vehicle'];
// Iterate through items, allocating to containers
for (let i of context.items) {
i.img = i.img || DEFAULT_TOKEN;
if (i.type === 'ability') {
abilities.push(i);
}
else if (i.type === 'specialty') {
specialties.push(i);
}
else if (i.type === 'background') {
backgrounds.push(i);
}
else if (i.type === 'evolution') {
evolutions.push(i);
}
else if (i.type === 'trauma') {
traumas.push(i);
}
context.totem_abilities = this.actor.itemTypes['ability'].filter(i=>i.system.type === 'totem');
context.abilities = this.actor.itemTypes['ability'].filter(i=>i.system.type !== 'totem');
}
// Assign and return
context.abilities = abilities;
context.specialties = specialties;
context.backgrounds = backgrounds;
context.evolutions = evolutions;
context.traumas = traumas;
context.members = [];
context.encounters = [];
@@ -134,13 +112,6 @@ export class VermineGroupSheet extends VermineActorSheet {
context.encounters.push(game.actors.get(encounterId));
}
context.gear = this.actor.itemTypes['item'];
context.weapons = this.actor.itemTypes['weapon'];
context.defenses = this.actor.itemTypes['defense'];
context.vehicles = this.actor.itemTypes['vehicle'];
context.totem_abilities = this.actor.itemTypes['ability'].filter(i=>i.type !== 'totem');
context.abilities = this.actor.itemTypes['ability'].filter(i=>i.type === 'totem');
}
+3 -3
View File
@@ -10,10 +10,10 @@ export class VermineNpcSheet extends VermineActorSheet {
/** @override */
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["vermine2047", "sheet", "actor"],
classes: ["vermine2047", "sheet", "actor", "npc"],
template: "systems/vermine2047/templates/actor/actor-sheet.hbs",
width: 600,
height: 600,
width: 400,
height: 400,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]
});
}
+1 -6
View File
@@ -8,15 +8,10 @@
// Actor partials.
"systems/vermine2047/templates/actor/parts/actor-id.hbs",
"systems/vermine2047/templates/actor/parts/actor-totem.hbs",
"systems/vermine2047/templates/actor/parts/character-features.hbs",
"systems/vermine2047/templates/actor/parts/character-header.hbs",
"systems/vermine2047/templates/actor/parts/actor-features.hbs",
"systems/vermine2047/templates/actor/parts/actor-items.hbs",
"systems/vermine2047/templates/actor/parts/actor-weapons.hbs",
"systems/vermine2047/templates/actor/parts/actor-defenses.hbs",
"systems/vermine2047/templates/actor/parts/actor-stories.hbs",
"systems/vermine2047/templates/actor/parts/actor-combat.hbs",
// Character partials.
"systems/vermine2047/templates/actor/character/character-id.hbs",
+1 -1
View File
@@ -2,7 +2,7 @@
"id": "vermine2047",
"title": "Vermine 2047",
"description": "The Vermine 2047 system for FoundryVTT!",
"version": "0.1.8",
"version": "0.1.9",
"compatibility": {
"minimum": "10",
"verified": "10.287",
+11 -1
View File
@@ -383,6 +383,11 @@
"creature": {
"templates": ["base"],
"skills": "",
"modes": {
"survival": true,
"nightmare": true,
"apocalypse": false
},
"pattern": {
"value": 1,
"min": 1,
@@ -437,7 +442,12 @@
},
"ability": {
"templates": ["list"],
"type": "character",
"type": "",
"totem": "",
"learn": {
"threshold":5,
"hindrance":0
},
"level": {
"value": 1,
"min": 1,
@@ -7,7 +7,6 @@
<ol class="list-item">
{{#each members as |actor id|}}
<li class="actor flexrow" data-actor-id="{{actor._id}}">
{{ log actor }}
<div class="actor-name" style="flex:4;">
<a class="item-control">{{actor.name}}</a>
</div>
+20 -2
View File
@@ -14,16 +14,34 @@
<aside style="flex:1">
<div class="resource">
<label class="resource-label">{{ localize "VERMINE.level"}}</label>
<input type="number" name="system.level" value="{{system.level}}" data-dtype="Number"/>
<input type="number" name="system.level.value" value="{{system.level.value }}" data-dtype="Number" min="{{system.level.min }}" max="{{system.level.max }}" />
</div>
{{#if (eq system.type "group")}}
<div class="resource row mdb">
<label class="resource-label">{{ localize "ITEMS.learning"}}</label>
<div class=" flexrow row">
<input type="number" name="system.learning.threshold" value="{{system.learning.threshold }}" data-dtype="Number" min="3" max="10" /> /
<input type="number" name="system.learning.hindrance" value="{{system.learning.hindrance }}" data-dtype="Number" min="0" max="3" />
</div>
</div>
{{/if}}
<div class="resource">
<label class="resource-label">{{ localize "VERMINE.type"}}</label>
<select name="system.type" value="{{system.type}}" data-dtype="String">
<select name="system.type" data-dtype="String">
<option value="character" {{#if (eq system.type "character")}}selected{{/if}}>Personnage</option>
<option value="group" {{#if (eq system.type "group")}}selected{{/if}}>Groupe</option>
<option value="group" {{#if (eq system.type "creature")}}selected{{/if}}>Créature</option>
<option value="totem" {{#if (eq system.type "totem")}}selected{{/if}}>Totem</option>
</select>
</div>
<div class="resource">
<label class="resource-label">{{ localize "VERMINE.totem"}}</label>
<select name="system.totem" data-dtype="String">
{{#each config.totems as | totem tk|}}
<option value="{{tk}}" {{#if (eq tk @root.system.totem)}}selected="selected"{{/if}}>{{ localize totem }}</option>
{{/each}}
</select>
</div>
</aside>
<main class="editor-wrapper" style="flex:10">
{{editor system.description target="system.description" rollData=rollData button=true owner=owner editable=editable}}