Initial import
BIN
images/ui/D12_Black.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
images/ui/D12_Black.webp
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
images/ui/D12_White.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
images/ui/D12_White.webp
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
images/ui/logo.png
Normal file
After Width: | Height: | Size: 268 KiB |
BIN
images/ui/logo.webp
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
images/ui/logo_pause.webp
Normal file
After Width: | Height: | Size: 82 KiB |
22
lang/fr.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"ACTOR": {
|
||||
"TypeCharacter": "Character",
|
||||
"TypeNpc": "NPC"
|
||||
},
|
||||
"ITEM": {
|
||||
"TypeWeapon": "Weapon",
|
||||
"TypeShield": "Shield",
|
||||
"TypeArmor": "Armor",
|
||||
"TypeSpell": "Spell",
|
||||
"TypeModule": "Module",
|
||||
"TypeMoney": "Money",
|
||||
"TypeEquipment": "Equipment",
|
||||
"TypeAction": "Action",
|
||||
"TypeFreeaction": "Free Action",
|
||||
"TypeReaction": "Reaction",
|
||||
"TypeStance": "Stance",
|
||||
"TypeTrait": "Trait",
|
||||
"TypeCondition": "Condition",
|
||||
"TypeCraftingskill": "Crafting Skill"
|
||||
}
|
||||
}
|
163
modules/malefices-actor-sheet.js
Normal file
@ -0,0 +1,163 @@
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class MaleficesActorSheet extends ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-malefices", "sheet", "actor"],
|
||||
template: "systems/fvtt-malefices/templates/actors/actor-sheet.hbs",
|
||||
width: 960,
|
||||
height: 720,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "skills" }],
|
||||
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
|
||||
editScore: true
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.actor.id,
|
||||
type: this.actor.type,
|
||||
img: this.actor.img,
|
||||
name: this.actor.name,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
system: duplicate(this.object.system),
|
||||
limited: this.object.limited,
|
||||
armes: duplicate(this.actor.getArmes()),
|
||||
equipements: duplicate(this.actor.getEquipements()),
|
||||
subActors: duplicate(this.actor.getSubActors()),
|
||||
focusData: this.actor.computeFinalFocusData(),
|
||||
encCurrent: this.actor.encCurrent,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
editScore: this.options.editScore,
|
||||
isGM: game.user.isGM
|
||||
}
|
||||
this.formData = formData;
|
||||
|
||||
console.log("PC : ", formData, this.object);
|
||||
return formData;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
html.bind("keydown", function(e) { // Ignore Enter in actores sheet
|
||||
if (e.keyCode === 13) return false;
|
||||
});
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
let itemId = li.data("item-id")
|
||||
const item = this.actor.items.get( itemId );
|
||||
item.sheet.render(true);
|
||||
});
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
MaleficesUtility.confirmDelete(this, li)
|
||||
})
|
||||
html.find('.item-add').click(ev => {
|
||||
let dataType = $(ev.currentTarget).data("type")
|
||||
this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true })
|
||||
})
|
||||
|
||||
html.find('.subactor-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
let actorId = li.data("actor-id");
|
||||
let actor = game.actors.get( actorId );
|
||||
actor.sheet.render(true);
|
||||
});
|
||||
|
||||
html.find('.subactor-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
let actorId = li.data("actor-id");
|
||||
this.actor.delSubActor(actorId);
|
||||
});
|
||||
html.find('.quantity-minus').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
this.actor.incDecQuantity( li.data("item-id"), -1 );
|
||||
} );
|
||||
html.find('.quantity-plus').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
this.actor.incDecQuantity( li.data("item-id"), +1 );
|
||||
} );
|
||||
|
||||
html.find('.ammo-minus').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
this.actor.incDecAmmo( li.data("item-id"), -1 );
|
||||
} );
|
||||
html.find('.ammo-plus').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
this.actor.incDecAmmo( li.data("item-id"), +1 )
|
||||
} );
|
||||
|
||||
html.find('.roll-attribut').click((event) => {
|
||||
let attrKey = $(event.currentTarget).data("attr-key")
|
||||
let skillKey = $(event.currentTarget).data("skill-key")
|
||||
this.actor.rollSkill(attrKey, skillKey)
|
||||
});
|
||||
html.find('.roll-arme').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
const weponId = li.data("item-id")
|
||||
this.actor.rollWeapon(weponId)
|
||||
});
|
||||
|
||||
html.find('.lock-unlock-sheet').click((event) => {
|
||||
this.options.editScore = !this.options.editScore;
|
||||
this.render(true);
|
||||
});
|
||||
html.find('.item-link a').click((event) => {
|
||||
const itemId = $(event.currentTarget).data("item-id");
|
||||
const item = this.actor.getOwnedItem(itemId);
|
||||
item.sheet.render(true);
|
||||
});
|
||||
html.find('.item-equip').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
this.actor.equipItem( li.data("item-id") );
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
html.find('.update-field').change(ev => {
|
||||
const fieldName = $(ev.currentTarget).data("field-name");
|
||||
let value = Number(ev.currentTarget.value);
|
||||
this.actor.update( { [`${fieldName}`]: value } );
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @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);
|
||||
}
|
||||
}
|
327
modules/malefices-actor.js
Normal file
@ -0,0 +1,327 @@
|
||||
/* -------------------------------------------- */
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
import { MaleficesRollDialog } from "./malefices-roll-dialog.js";
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
* Extend the base Actor entity by defining a custom roll data structure which is ideal for the Simple system.
|
||||
* @extends {Actor}
|
||||
*/
|
||||
export class MaleficesActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/**
|
||||
* Override the create() function to provide additional SoS functionality.
|
||||
*
|
||||
* This overrided create() function adds initial items
|
||||
* Namely: Basic skills, money,
|
||||
*
|
||||
* @param {Object} data Barebones actor data which this function adds onto.
|
||||
* @param {Object} options (Unused) Additional options which customize the creation workflow.
|
||||
*
|
||||
*/
|
||||
|
||||
static async create(data, options) {
|
||||
|
||||
// Case of compendium global import
|
||||
if (data instanceof Array) {
|
||||
return super.create(data, options);
|
||||
}
|
||||
// If the created actor has items (only applicable to duplicated actors) bypass the new actor creation logic
|
||||
if (data.items) {
|
||||
let actor = super.create(data, options);
|
||||
return actor;
|
||||
}
|
||||
|
||||
if (data.type == 'character') {
|
||||
}
|
||||
if (data.type == 'npc') {
|
||||
}
|
||||
|
||||
return super.create(data, options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareBaseData() {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async prepareData() {
|
||||
|
||||
super.prepareData()
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
computeHitPoints() {
|
||||
if (this.type == "character") {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareDerivedData() {
|
||||
|
||||
if (this.type == 'character' || game.user.isGM) {
|
||||
}
|
||||
|
||||
super.prepareDerivedData();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_preUpdate(changed, options, user) {
|
||||
|
||||
super._preUpdate(changed, options, user);
|
||||
}
|
||||
|
||||
/*_onUpdateEmbeddedDocuments( embeddedName, ...args ) {
|
||||
this.rebuildSkills()
|
||||
super._onUpdateEmbeddedDocuments(embeddedName, ...args)
|
||||
}*/
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getMoneys() {
|
||||
let comp = this.items.filter(item => item.type == 'money');
|
||||
MaleficesUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getArmes() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'arme') || [])
|
||||
MaleficesUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getItemById(id) {
|
||||
let item = this.items.find(item => item.id == id);
|
||||
if (item) {
|
||||
item = duplicate(item)
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async equipItem(itemId) {
|
||||
let item = this.items.find(item => item.id == itemId)
|
||||
if (item && item.system) {
|
||||
if (item.type == "armor") {
|
||||
let armor = this.items.find(item => item.id != itemId && item.type == "armor" && item.system.equipped)
|
||||
if (armor) {
|
||||
ui.notifications.warn("You already have an armor equipped!")
|
||||
return
|
||||
}
|
||||
}
|
||||
if (item.type == "shield") {
|
||||
let shield = this.items.find(item => item.id != itemId && item.type == "shield" && item.system.equipped)
|
||||
if (shield) {
|
||||
ui.notifications.warn("You already have a shield equipped!")
|
||||
return
|
||||
}
|
||||
}
|
||||
let update = { _id: item.id, "system.equipped": !item.system.equipped };
|
||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
compareName(a, b) {
|
||||
if (a.name < b.name) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name > b.name) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ------------------------------------------- */
|
||||
getEquipements() {
|
||||
return this.items.filter(item => item.type == 'equipement')
|
||||
}
|
||||
|
||||
/* ------------------------------------------- */
|
||||
async buildContainerTree() {
|
||||
let equipments = duplicate(this.items.filter(item => item.type == "equipment") || [])
|
||||
for (let equip1 of equipments) {
|
||||
if (equip1.system.iscontainer) {
|
||||
equip1.system.contents = []
|
||||
equip1.system.contentsEnc = 0
|
||||
for (let equip2 of equipments) {
|
||||
if (equip1._id != equip2.id && equip2.system.containerid == equip1.id) {
|
||||
equip1.system.contents.push(equip2)
|
||||
let q = equip2.system.quantity ?? 1
|
||||
equip1.system.contentsEnc += q * equip2.system.weight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Compute whole enc
|
||||
let enc = 0
|
||||
for (let item of equipments) {
|
||||
//item.data.idrDice = MaleficesUtility.getDiceFromLevel(Number(item.data.idr))
|
||||
if (item.system.equipped) {
|
||||
if (item.system.iscontainer) {
|
||||
enc += item.system.contentsEnc
|
||||
} else if (item.system.containerid == "") {
|
||||
let q = item.system.quantity ?? 1
|
||||
enc += q * item.system.weight
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let item of this.items) { // Process items/shields/armors
|
||||
if ((item.type == "weapon" || item.type == "shield" || item.type == "armor") && item.system.equipped) {
|
||||
let q = item.system.quantity ?? 1
|
||||
enc += q * item.system.weight
|
||||
}
|
||||
}
|
||||
|
||||
// Store local values
|
||||
this.encCurrent = enc
|
||||
this.containersTree = equipments.filter(item => item.system.containerid == "") // Returns the root of equipements without container
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async equipGear(equipmentId) {
|
||||
let item = this.items.find(item => item.id == equipmentId);
|
||||
if (item && item.system) {
|
||||
let update = { _id: item.id, "system.equipped": !item.system.equipped };
|
||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
clearInitiative(){
|
||||
this.getFlag("world", "initiative", -1)
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getInitiativeScore(combatId, combatantId) {
|
||||
if (this.type == 'character') {
|
||||
let init = this.getFlag("world", "initiative" )
|
||||
console.log("INIT", init)
|
||||
if (!init || init == -1) {
|
||||
ChatMessage.create( { content: "Roll your initiative for this combat"} )
|
||||
}
|
||||
return init
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSubActors() {
|
||||
let subActors = [];
|
||||
for (let id of this.system.subactors) {
|
||||
subActors.push(duplicate(game.actors.get(id)))
|
||||
}
|
||||
return subActors;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addSubActor(subActorId) {
|
||||
let subActors = duplicate(this.system.subactors);
|
||||
subActors.push(subActorId);
|
||||
await this.update({ 'system.subactors': subActors });
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async delSubActor(subActorId) {
|
||||
let newArray = [];
|
||||
for (let id of this.system.subactors) {
|
||||
if (id != subActorId) {
|
||||
newArray.push(id);
|
||||
}
|
||||
}
|
||||
await this.update({ 'system.subactors': newArray });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async deleteAllItemsByType(itemType) {
|
||||
let items = this.items.filter(item => item.type == itemType);
|
||||
await this.deleteEmbeddedDocuments('Item', items);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addItemWithoutDuplicate(newItem) {
|
||||
let item = this.items.find(item => item.type == newItem.type && item.name.toLowerCase() == newItem.name.toLowerCase())
|
||||
if (!item) {
|
||||
await this.createEmbeddedDocuments('Item', [newItem]);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incDecQuantity(objetId, incDec = 0) {
|
||||
let objetQ = this.items.get(objetId)
|
||||
if (objetQ) {
|
||||
let newQ = objetQ.system.quantity + incDec
|
||||
if (newQ >= 0) {
|
||||
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantity': newQ }]) // pdates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async incDecAmmo(objetId, incDec = 0) {
|
||||
let objetQ = this.items.get(objetId)
|
||||
if (objetQ) {
|
||||
let newQ = objetQ.system.ammocurrent + incDec;
|
||||
if (newQ >= 0 && newQ <= objetQ.system.ammomax) {
|
||||
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.ammocurrent': newQ }]); // pdates one EmbeddedEntity
|
||||
}
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getCommonRollData() {
|
||||
|
||||
let rollData = MaleficesUtility.getBasicRollData()
|
||||
rollData.alias = this.name
|
||||
rollData.actorImg = this.img
|
||||
rollData.actorId = this.id
|
||||
rollData.img = this.img
|
||||
|
||||
console.log("ROLLDATA", rollData)
|
||||
|
||||
return rollData
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollAtribut(attrKey, skillKey) {
|
||||
let attr = this.system.attributes[attrKey]
|
||||
let skill = attr.skills[skillKey]
|
||||
if (skill) {
|
||||
skill = duplicate(skill)
|
||||
skill.name = MaleficesUtility.upperFirst(skillKey)
|
||||
skill.attr = duplicate(attr)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "skill"
|
||||
rollMode.skillKey = skillKey
|
||||
rollData.skill = skill
|
||||
rollData.title = "Roll Skill " + skill.name
|
||||
rollData.img = skill.img
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme(weaponId) {
|
||||
let weapon = this.items.get(weaponId)
|
||||
if (weapon) {
|
||||
weapon = duplicate(weapon)
|
||||
this.prepareWeapon(weapon)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.modifier = this.system.bonus[weapon.system.weapontype]
|
||||
rollData.mode = "weapon"
|
||||
rollData.weapon = weapon
|
||||
rollData.img = weapon.img
|
||||
this.startRoll(rollData)
|
||||
} else {
|
||||
ui.notifications.warn("Unable to find the relevant weapon ")
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async startRoll(rollData) {
|
||||
this.syncRoll(rollData)
|
||||
let rollDialog = await MaleficesRollDialog.create(this, rollData)
|
||||
rollDialog.render(true)
|
||||
}
|
||||
|
||||
}
|
40
modules/malefices-combat.js
Normal file
@ -0,0 +1,40 @@
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class MaleficesCombat extends Combat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollInitiative(ids, formula = undefined, messageOptions = {} ) {
|
||||
ids = typeof ids === "string" ? [ids] : ids;
|
||||
for (let cId = 0; cId < ids.length; cId++) {
|
||||
const c = this.combatants.get(ids[cId]);
|
||||
let id = c._id || c.id;
|
||||
let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, id ) : -1;
|
||||
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_onUpdate(changed, options, userId) {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async checkTurnPosition() {
|
||||
while (game.combat.turn > 0) {
|
||||
await game.combat.previousTurn()
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_onDelete() {
|
||||
let combatants = this.combatants.contents
|
||||
for (let c of combatants) {
|
||||
let actor = game.actors.get(c.actorId)
|
||||
actor.clearInitiative()
|
||||
}
|
||||
super._onDelete()
|
||||
}
|
||||
|
||||
}
|
117
modules/malefices-commands.js
Normal file
@ -0,0 +1,117 @@
|
||||
/* -------------------------------------------- */
|
||||
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
import { MaleficesRollDialog } from "./malefices-roll-dialog.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class MaleficesCommands {
|
||||
|
||||
static init() {
|
||||
if (!game.system.Malefices.commands) {
|
||||
const MaleficesCommands = new MaleficesCommands();
|
||||
//crucibleCommands.registerCommand({ path: ["/char"], func: (content, msg, params) => crucibleCommands.createChar(msg), descr: "Create a new character" });
|
||||
//crucibleCommands.registerCommand({ path: ["/pool"], func: (content, msg, params) => crucibleCommands.poolRoll(msg), descr: "Generic Roll Window" });
|
||||
game.system.Malefices.commands = MaleficesCommands;
|
||||
}
|
||||
}
|
||||
constructor() {
|
||||
this.commandsTable = {}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
registerCommand(command) {
|
||||
this._addCommand(this.commandsTable, command.path, '', command);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_addCommand(targetTable, path, fullPath, command) {
|
||||
if (!this._validateCommand(targetTable, path, command)) {
|
||||
return;
|
||||
}
|
||||
const term = path[0];
|
||||
fullPath = fullPath + term + ' '
|
||||
if (path.length == 1) {
|
||||
command.descr = `<strong>${fullPath}</strong>: ${command.descr}`;
|
||||
targetTable[term] = command;
|
||||
}
|
||||
else {
|
||||
if (!targetTable[term]) {
|
||||
targetTable[term] = { subTable: {} };
|
||||
}
|
||||
this._addCommand(targetTable[term].subTable, path.slice(1), fullPath, command)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_validateCommand(targetTable, path, command) {
|
||||
if (path.length > 0 && path[0] && command.descr && (path.length != 1 || targetTable[path[0]] == undefined)) {
|
||||
return true;
|
||||
}
|
||||
console.warn("crucibleCommands._validateCommand failed ", targetTable, path, command);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Manage chat commands */
|
||||
processChatCommand(commandLine, content = '', msg = {}) {
|
||||
// Setup new message's visibility
|
||||
let rollMode = game.settings.get("core", "rollMode");
|
||||
if (["gmroll", "blindroll"].includes(rollMode)) msg["whisper"] = ChatMessage.getWhisperRecipients("GM");
|
||||
if (rollMode === "blindroll") msg["blind"] = true;
|
||||
msg["type"] = 0;
|
||||
|
||||
let command = commandLine[0].toLowerCase();
|
||||
let params = commandLine.slice(1);
|
||||
|
||||
return this.process(command, params, content, msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
process(command, params, content, msg) {
|
||||
return this._processCommand(this.commandsTable, command, params, content, msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_processCommand(commandsTable, name, params, content = '', msg = {}, path = "") {
|
||||
console.log("===> Processing command")
|
||||
let command = commandsTable[name];
|
||||
path = path + name + " ";
|
||||
if (command && command.subTable) {
|
||||
if (params[0]) {
|
||||
return this._processCommand(command.subTable, params[0], params.slice(1), content, msg, path)
|
||||
}
|
||||
else {
|
||||
this.help(msg, command.subTable);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (command && command.func) {
|
||||
const result = command.func(content, msg, params);
|
||||
if (result == false) {
|
||||
CrucibleCommands._chatAnswer(msg, command.descr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static _chatAnswer(msg, content) {
|
||||
msg.whisper = [game.user.id];
|
||||
msg.content = content;
|
||||
ChatMessage.create(msg);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async poolRoll( msg) {
|
||||
let rollData = MaleficesUtility.getBasicRollData()
|
||||
rollData.alias = "Dice Pool Roll",
|
||||
rollData.mode = "generic"
|
||||
rollData.title = `Dice Pool Roll`;
|
||||
|
||||
let rollDialog = await MaleficesRollDialog.create( this, rollData);
|
||||
rollDialog.render( true );
|
||||
}
|
||||
|
||||
}
|
15
modules/malefices-config.js
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
export const MALEFICES_CONFIG = {
|
||||
|
||||
armeTypes : {
|
||||
"fusilchasse": "Fusil de Chasse",
|
||||
"fusilguerre": "Fusil de Guerre",
|
||||
"pistoletgros": "Pistolet (gros calibre)",
|
||||
"pistoletmoyen": "Pistolet (moyen calibre)",
|
||||
"pistoletpetit": "Pistolet (petit calibre)",
|
||||
"arbalete": "Arbalète",
|
||||
"arc": "Arc",
|
||||
"epee": "Epée, sabre, javelot, etc",
|
||||
"mainsnues": "Mains Nues"
|
||||
},
|
||||
}
|
86
modules/malefices-hotbar.js
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
export class MaleficesHotbar {
|
||||
|
||||
/**
|
||||
* Create a macro when dropping an entity on the hotbar
|
||||
* Item - open roll dialog for item
|
||||
* Actor - open actor sheet
|
||||
* Journal - open journal sheet
|
||||
*/
|
||||
static init( ) {
|
||||
|
||||
Hooks.on("hotbarDrop", async (bar, documentData, slot) => {
|
||||
// Create item macro if rollable item - weapon, spell, prayer, trait, or skill
|
||||
if (documentData.type == "Item") {
|
||||
console.log("Drop done !!!", bar, documentData, slot)
|
||||
let item = documentData.data
|
||||
let command = `game.system.Malefices.MaleficesHotbar.rollMacro("${item.name}", "${item.type}");`
|
||||
let macro = game.macros.contents.find(m => (m.name === item.name) && (m.command === command))
|
||||
if (!macro) {
|
||||
macro = await Macro.create({
|
||||
name: item.name,
|
||||
type: "script",
|
||||
img: item.img,
|
||||
command: command
|
||||
}, { displaySheet: false })
|
||||
}
|
||||
game.user.assignHotbarMacro(macro, slot);
|
||||
}
|
||||
// Create a macro to open the actor sheet of the actor dropped on the hotbar
|
||||
else if (documentData.type == "Actor") {
|
||||
let actor = game.actors.get(documentData.id);
|
||||
let command = `game.actors.get("${documentData.id}").sheet.render(true)`
|
||||
let macro = game.macros.contents.find(m => (m.name === actor.name) && (m.command === command));
|
||||
if (!macro) {
|
||||
macro = await Macro.create({
|
||||
name: actor.data.name,
|
||||
type: "script",
|
||||
img: actor.data.img,
|
||||
command: command
|
||||
}, { displaySheet: false })
|
||||
game.user.assignHotbarMacro(macro, slot);
|
||||
}
|
||||
}
|
||||
// Create a macro to open the journal sheet of the journal dropped on the hotbar
|
||||
else if (documentData.type == "JournalEntry") {
|
||||
let journal = game.journal.get(documentData.id);
|
||||
let command = `game.journal.get("${documentData.id}").sheet.render(true)`
|
||||
let macro = game.macros.contents.find(m => (m.name === journal.name) && (m.command === command));
|
||||
if (!macro) {
|
||||
macro = await Macro.create({
|
||||
name: journal.data.name,
|
||||
type: "script",
|
||||
img: "",
|
||||
command: command
|
||||
}, { displaySheet: false })
|
||||
game.user.assignHotbarMacro(macro, slot);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/** Roll macro */
|
||||
static rollMacro(itemName, itemType, bypassData) {
|
||||
const speaker = ChatMessage.getSpeaker()
|
||||
let actor
|
||||
if (speaker.token) actor = game.actors.tokens[speaker.token]
|
||||
if (!actor) actor = game.actors.get(speaker.actor)
|
||||
if (!actor) {
|
||||
return ui.notifications.warn(`Select your actor to run the macro`)
|
||||
}
|
||||
|
||||
let item = actor.items.find(it => it.name === itemName && it.type == itemType)
|
||||
if (!item ) {
|
||||
return ui.notifications.warn(`Unable to find the item of the macro in the current actor`)
|
||||
}
|
||||
// Trigger the item roll
|
||||
if (item.type === "weapon") {
|
||||
return actor.rollWeapon( item.id)
|
||||
}
|
||||
if (item.type === "skill") {
|
||||
return actor.rollSkill( item.id)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
181
modules/malefices-item-sheet.js
Normal file
@ -0,0 +1,181 @@
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class MaleficesItemSheet extends ItemSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-malefices", "sheet", "item"],
|
||||
template: "systems/fvtt-malefices/templates/item-sheet.hbs",
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
||||
width: 620,
|
||||
height: 480,
|
||||
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 => { }
|
||||
})
|
||||
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);
|
||||
if (this.item.type.includes('weapon')) {
|
||||
position.width = 640;
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.id,
|
||||
type: this.object.type,
|
||||
img: this.object.img,
|
||||
name: this.object.name,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
system: duplicate(this.object.system),
|
||||
config: duplicate(game.system.malefices),
|
||||
limited: this.object.limited,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
description: await TextEditor.enrichHTML(this.object.system.description, { async: true }),
|
||||
isGM: game.user.isGM
|
||||
}
|
||||
|
||||
this.options.editable = !(this.object.origin == "embeddedItem");
|
||||
console.log("ITEM DATA", formData, this);
|
||||
return formData;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_getHeaderButtons() {
|
||||
let buttons = super._getHeaderButtons();
|
||||
buttons.unshift({
|
||||
class: "post",
|
||||
icon: "fas fa-comment",
|
||||
onclick: ev => this.postItem()
|
||||
});
|
||||
return buttons
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
postItem() {
|
||||
let chatData = duplicate(this.item)
|
||||
if (this.actor) {
|
||||
chatData.actor = { id: this.actor.id };
|
||||
}
|
||||
// Don't post any image for the item (which would leave a large gap) if the default image is used
|
||||
if (chatData.img.includes("/blank.png")) {
|
||||
chatData.img = null;
|
||||
}
|
||||
// JSON object for easy creation
|
||||
chatData.jsondata = JSON.stringify(
|
||||
{
|
||||
compendium: "postedItem",
|
||||
payload: chatData,
|
||||
});
|
||||
|
||||
renderTemplate('systems/Malefices/templates/post-item.html', chatData).then(html => {
|
||||
let chatOptions = MaleficesUtility.chatDataSetup(html);
|
||||
ChatMessage.create(chatOptions)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async viewSubitem(ev) {
|
||||
let levelIndex = Number($(ev.currentTarget).parents(".item").data("level-index"))
|
||||
let choiceIndex = Number($(ev.currentTarget).parents(".item").data("choice-index"))
|
||||
let featureId = $(ev.currentTarget).parents(".item").data("feature-id")
|
||||
|
||||
let itemData = this.object.system.levels[levelIndex].choices[choiceIndex].features[featureId]
|
||||
|
||||
if (itemData.name != 'None') {
|
||||
let item = await Item.create(itemData, { temporary: true });
|
||||
item.system.origin = "embeddedItem";
|
||||
new MaleficesItemSheet(item).render(true);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async deleteSubitem(ev) {
|
||||
let field = $(ev.currentTarget).data('type');
|
||||
let idx = Number($(ev.currentTarget).data('index'));
|
||||
let oldArray = this.object.system[field];
|
||||
let itemData = this.object.system[field][idx];
|
||||
if (itemData.name != 'None') {
|
||||
let newArray = [];
|
||||
for (var i = 0; i < oldArray.length; i++) {
|
||||
if (i != idx) {
|
||||
newArray.push(oldArray[i]);
|
||||
}
|
||||
}
|
||||
this.object.update({ [`system.${field}`]: newArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// 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.object.options.actor.getOwnedItem(li.data("item-id"));
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
html.find('.delete-subitem').click(ev => {
|
||||
this.deleteSubitem(ev);
|
||||
});
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
let itemId = li.data("item-id");
|
||||
let itemType = li.data("item-type");
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
get template() {
|
||||
let type = this.item.type;
|
||||
return `systems/fvtt-malefices/templates/items/item-${type}-sheet.hbs`
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
_updateObject(event, formData) {
|
||||
return this.object.update(formData)
|
||||
}
|
||||
}
|
21
modules/malefices-item.js
Normal file
@ -0,0 +1,21 @@
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
|
||||
export const defaultItemImg = {
|
||||
//skill: "systems/fvtt-malefices/images/icons/skill1.webp",
|
||||
arme: "systems/fvtt-malefices/images/icones/arme.webp"
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class MaleficesItem extends Item {
|
||||
|
||||
constructor(data, context) {
|
||||
if (!data.img) {
|
||||
data.img = defaultItemImg[data.type];
|
||||
}
|
||||
super(data, context);
|
||||
}
|
||||
|
||||
}
|
117
modules/malefices-main.js
Normal file
@ -0,0 +1,117 @@
|
||||
/**
|
||||
* Malefices system
|
||||
* Author: Uberwald
|
||||
* Software License: Prop
|
||||
*/
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Import Modules
|
||||
import { MaleficesActor } from "./malefices-actor.js";
|
||||
import { MaleficesItemSheet } from "./malefices-item-sheet.js";
|
||||
import { MaleficesActorSheet } from "./malefices-actor-sheet.js";
|
||||
import { MaleficesNPCSheet } from "./malefices-npc-sheet.js";
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
import { MaleficesCombat } from "./malefices-combat.js";
|
||||
import { MaleficesItem } from "./malefices-item.js";
|
||||
import { MaleficesHotbar } from "./malefices-hotbar.js"
|
||||
import { MALEFICES_CONFIG } from "./malefices-config.js"
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/************************************************************************************/
|
||||
Hooks.once("init", async function () {
|
||||
|
||||
console.log(`Initializing Malefices RPG`);
|
||||
|
||||
game.system.malefices = {
|
||||
config: MALEFICES_CONFIG,
|
||||
MaleficesHotbar
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// preload handlebars templates
|
||||
MaleficesUtility.preloadHandlebarsTemplates();
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Set an initiative formula for the system
|
||||
CONFIG.Combat.initiative = {
|
||||
formula: "1d6",
|
||||
decimals: 1
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
game.socket.on("system.fvtt-malefices", data => {
|
||||
MaleficesUtility.onSocketMesssage(data)
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Define custom Entity classes
|
||||
CONFIG.Combat.documentClass = MaleficesCombat
|
||||
CONFIG.Actor.documentClass = MaleficesActor
|
||||
CONFIG.Item.documentClass = MaleficesItem
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
Actors.registerSheet("fvtt-malefices", MaleficesActorSheet, { types: ["personnage"], makeDefault: true });
|
||||
Actors.registerSheet("fvtt-malefices", MaleficesNPCSheet, { types: ["pnj"], makeDefault: false });
|
||||
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
Items.registerSheet("fvtt-malefices", MaleficesItemSheet, { makeDefault: true });
|
||||
|
||||
MaleficesUtility.init()
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
function welcomeMessage() {
|
||||
ChatMessage.create({
|
||||
user: game.user.id,
|
||||
whisper: [game.user.id],
|
||||
content: `<div id="welcome-message-Malefices"><span class="rdd-roll-part">
|
||||
<strong>Bienvenu dans Malefices, le JDR qui sent le souffre !</strong>
|
||||
` });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
Hooks.once("ready", function () {
|
||||
|
||||
// User warning
|
||||
if (!game.user.isGM && game.user.character == undefined) {
|
||||
ui.notifications.info("Attention ! Aucun personnage relié au joueur !");
|
||||
ChatMessage.create({
|
||||
content: "<b>WARNING</b> Le joueur " + game.user.name + " n'est pas relié à un personnage !",
|
||||
user: game.user._id
|
||||
});
|
||||
}
|
||||
|
||||
// CSS patch for v9
|
||||
if (game.version) {
|
||||
let sidebar = document.getElementById("sidebar");
|
||||
sidebar.style.width = "min-content";
|
||||
}
|
||||
|
||||
welcomeMessage();
|
||||
MaleficesUtility.ready()
|
||||
MaleficesUtility.init()
|
||||
})
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
Hooks.on("chatMessage", (html, content, msg) => {
|
||||
if (content[0] == '/') {
|
||||
let regExp = /(\S+)/g;
|
||||
let commands = content.match(regExp);
|
||||
if (game.system.Malefices.commands.processChatCommand(commands, content, msg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
207
modules/malefices-npc-sheet.js
Normal file
@ -0,0 +1,207 @@
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class MaleficesNPCSheet extends ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["Malefices", "sheet", "actor"],
|
||||
template: "systems/fvtt-malefices/templates/npc-sheet.html",
|
||||
width: 640,
|
||||
height: 720,
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "stats" }],
|
||||
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
|
||||
editScore: true
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const objectData = this.object.system
|
||||
let actorData = duplicate(objectData)
|
||||
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.actor.id,
|
||||
type: this.actor.type,
|
||||
img: this.actor.img,
|
||||
name: this.actor.name,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
data: actorData,
|
||||
limited: this.object.limited,
|
||||
skills: this.actor.getSkills( ),
|
||||
weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ),
|
||||
armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())),
|
||||
shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())),
|
||||
spells: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getLore())),
|
||||
equipments: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquipmentsOnly()) ),
|
||||
equippedWeapons: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquippedWeapons()) ),
|
||||
equippedArmor: this.actor.getEquippedArmor(),
|
||||
equippedShield: this.actor.getEquippedShield(),
|
||||
subActors: duplicate(this.actor.getSubActors()),
|
||||
moneys: duplicate(this.actor.getMoneys()),
|
||||
encCapacity: this.actor.getEncumbranceCapacity(),
|
||||
saveRolls: this.actor.getSaveRoll(),
|
||||
conditions: this.actor.getConditions(),
|
||||
containersTree: this.actor.containersTree,
|
||||
encCurrent: this.actor.encCurrent,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
editScore: this.options.editScore,
|
||||
isGM: game.user.isGM
|
||||
}
|
||||
this.formData = formData;
|
||||
|
||||
console.log("PC : ", formData, this.object);
|
||||
return formData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
// Everything below here is only needed if the sheet is editable
|
||||
if (!this.options.editable) return;
|
||||
|
||||
html.bind("keydown", function(e) { // Ignore Enter in actores sheet
|
||||
if (e.keyCode === 13) return false;
|
||||
});
|
||||
|
||||
// Update Inventory Item
|
||||
html.find('.item-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
let itemId = li.data("item-id")
|
||||
const item = this.actor.items.get( itemId );
|
||||
item.sheet.render(true);
|
||||
});
|
||||
// Delete Inventory Item
|
||||
html.find('.item-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
MaleficesUtility.confirmDelete(this, li)
|
||||
})
|
||||
html.find('.item-add').click(ev => {
|
||||
let dataType = $(ev.currentTarget).data("type")
|
||||
this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true })
|
||||
})
|
||||
|
||||
html.find('.equip-activate').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
let itemId = li.data("item-id")
|
||||
this.actor.equipActivate( itemId)
|
||||
});
|
||||
html.find('.equip-deactivate').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item")
|
||||
let itemId = li.data("item-id")
|
||||
this.actor.equipDeactivate( itemId)
|
||||
});
|
||||
|
||||
html.find('.subactor-edit').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
let actorId = li.data("actor-id");
|
||||
let actor = game.actors.get( actorId );
|
||||
actor.sheet.render(true);
|
||||
});
|
||||
|
||||
html.find('.subactor-delete').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
let actorId = li.data("actor-id");
|
||||
this.actor.delSubActor(actorId);
|
||||
});
|
||||
html.find('.quantity-minus').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
this.actor.incDecQuantity( li.data("item-id"), -1 );
|
||||
} );
|
||||
html.find('.quantity-plus').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
this.actor.incDecQuantity( li.data("item-id"), +1 );
|
||||
} );
|
||||
|
||||
html.find('.ammo-minus').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
this.actor.incDecAmmo( li.data("item-id"), -1 );
|
||||
} );
|
||||
html.find('.ammo-plus').click(event => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
this.actor.incDecAmmo( li.data("item-id"), +1 )
|
||||
} );
|
||||
|
||||
html.find('.roll-ability').click((event) => {
|
||||
const abilityKey = $(event.currentTarget).data("ability-key");
|
||||
this.actor.rollAbility(abilityKey);
|
||||
});
|
||||
html.find('.roll-skill').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item")
|
||||
const skillId = li.data("item-id")
|
||||
this.actor.rollSkill(skillId)
|
||||
});
|
||||
|
||||
html.find('.roll-weapon').click((event) => {
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
const skillId = li.data("item-id")
|
||||
this.actor.rollWeapon(skillId)
|
||||
});
|
||||
html.find('.roll-armor-die').click((event) => {
|
||||
this.actor.rollArmorDie()
|
||||
});
|
||||
html.find('.roll-shield-die').click((event) => {
|
||||
this.actor.rollShieldDie()
|
||||
});
|
||||
html.find('.roll-target-die').click((event) => {
|
||||
this.actor.rollDefenseRanged()
|
||||
});
|
||||
|
||||
html.find('.roll-save').click((event) => {
|
||||
const saveKey = $(event.currentTarget).data("save-key")
|
||||
this.actor.rollSave(saveKey)
|
||||
});
|
||||
|
||||
|
||||
html.find('.lock-unlock-sheet').click((event) => {
|
||||
this.options.editScore = !this.options.editScore;
|
||||
this.render(true);
|
||||
});
|
||||
html.find('.item-link a').click((event) => {
|
||||
const itemId = $(event.currentTarget).data("item-id");
|
||||
const item = this.actor.getOwnedItem(itemId);
|
||||
item.sheet.render(true);
|
||||
});
|
||||
html.find('.item-equip').click(ev => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
this.actor.equipItem( li.data("item-id") );
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
html.find('.update-field').change(ev => {
|
||||
const fieldName = $(ev.currentTarget).data("field-name");
|
||||
let value = Number(ev.currentTarget.value);
|
||||
this.actor.update( { [`${fieldName}`]: value } );
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @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);
|
||||
}
|
||||
}
|
69
modules/malefices-roll-dialog.js
Normal file
@ -0,0 +1,69 @@
|
||||
import { MaleficesUtility } from "./malefices-utility.js";
|
||||
|
||||
export class MaleficesRollDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, rollData) {
|
||||
|
||||
let options = { classes: ["MaleficesDialog"], width: 540, height: 'fit-content', 'z-index': 99999 };
|
||||
let html = await renderTemplate('systems/fvtt-malefices/templates/dialogs/roll-dialog-generic.hbs', rollData);
|
||||
|
||||
return new MaleficesRollDialog(actor, rollData, html, options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
constructor(actor, rollData, html, options, close = undefined) {
|
||||
let conf = {
|
||||
title: (rollData.mode == "skill") ? "Skill" : "Attribute",
|
||||
content: html,
|
||||
buttons: {
|
||||
roll: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Roll !",
|
||||
callback: () => { this.roll() }
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: "Cancel",
|
||||
callback: () => { this.close() }
|
||||
}
|
||||
},
|
||||
close: close
|
||||
}
|
||||
|
||||
super(conf, options);
|
||||
|
||||
this.actor = actor;
|
||||
this.rollData = rollData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
roll() {
|
||||
MaleficesUtility.rollMalefices(this.rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async refreshDialog() {
|
||||
const content = await renderTemplate("systems/fvtt-malefices/templates/dialogs/roll-dialog-generic.hbs", this.rollData)
|
||||
this.data.content = content
|
||||
this.render(true)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
var dialog = this;
|
||||
function onLoad() {
|
||||
}
|
||||
$(function () { onLoad(); });
|
||||
|
||||
html.find('#bonusMalusRoll').change((event) => {
|
||||
this.rollData.bonusMalusRoll = event.currentTarget.value
|
||||
})
|
||||
html.find('#targetCheck').change((event) => {
|
||||
this.rollData.targetCheck = event.currentTarget.value
|
||||
})
|
||||
|
||||
}
|
||||
}
|
701
modules/malefices-utility.js
Normal file
@ -0,0 +1,701 @@
|
||||
/* -------------------------------------------- */
|
||||
import { MaleficesCombat } from "./malefices-combat.js";
|
||||
import { MaleficesCommands } from "./malefices-commands.js";
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class MaleficesUtility {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async init() {
|
||||
Hooks.on('renderChatLog', (log, html, data) => MaleficesUtility.chatListeners(html));
|
||||
/*Hooks.on("dropCanvasData", (canvas, data) => {
|
||||
MaleficesUtility.dropItemOnToken(canvas, data)
|
||||
});*/
|
||||
|
||||
this.rollDataStore = {}
|
||||
this.defenderStore = {}
|
||||
|
||||
MaleficesCommands.init();
|
||||
|
||||
Handlebars.registerHelper('count', function (list) {
|
||||
return list.length;
|
||||
})
|
||||
Handlebars.registerHelper('includes', function (array, val) {
|
||||
return array.includes(val);
|
||||
})
|
||||
Handlebars.registerHelper('upper', function (text) {
|
||||
return text.toUpperCase();
|
||||
})
|
||||
Handlebars.registerHelper('lower', function (text) {
|
||||
return text.toLowerCase()
|
||||
})
|
||||
Handlebars.registerHelper('upperFirst', function (text) {
|
||||
if (typeof text !== 'string') return text
|
||||
return text.charAt(0).toUpperCase() + text.slice(1)
|
||||
})
|
||||
Handlebars.registerHelper('notEmpty', function (list) {
|
||||
return list.length > 0;
|
||||
})
|
||||
Handlebars.registerHelper('mul', function (a, b) {
|
||||
return parseInt(a) * parseInt(b);
|
||||
})
|
||||
Handlebars.registerHelper('add', function (a, b) {
|
||||
return parseInt(a) + parseInt(b);
|
||||
})
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
static upperFirst(text) {
|
||||
if (typeof text !== 'string') return text
|
||||
return text.charAt(0).toUpperCase() + text.slice(1)
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
static getSkills() {
|
||||
return duplicate(this.skills)
|
||||
}
|
||||
/*-------------------------------------------- */
|
||||
static getWeaponSkills() {
|
||||
return duplicate(this.weaponSkills)
|
||||
}
|
||||
/*-------------------------------------------- */
|
||||
static getShieldSkills() {
|
||||
return duplicate(this.shieldSkills)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isModuleItemAllowed(type) {
|
||||
return __ALLOWED_MODULE_TYPES[type]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildBonusList() {
|
||||
let bonusList = []
|
||||
for (let key in game.system.model.Actor.character.bonus) {
|
||||
let bonuses = game.system.model.Actor.character.bonus[key]
|
||||
for (let bonus in bonuses) {
|
||||
bonusList.push(key + "." + bonus)
|
||||
}
|
||||
}
|
||||
for (let key in game.system.model.Actor.character.attributes) {
|
||||
let attrs = game.system.model.Actor.character.attributes[key]
|
||||
for (let skillKey in attrs.skills) {
|
||||
bonusList.push(key + ".skills." + skillKey + ".modifier")
|
||||
}
|
||||
}
|
||||
for (let key in game.system.model.Actor.character.universal.skills) {
|
||||
bonusList.push("universal.skills." + key + ".modifier")
|
||||
}
|
||||
return bonusList
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async ready() {
|
||||
const skills = await MaleficesUtility.loadCompendium("fvtt-malefices.skills")
|
||||
this.skills = skills.map(i => i.toObject())
|
||||
this.weaponSkills = duplicate(this.skills.filter(item => item.system.isweaponskill))
|
||||
this.shieldSkills = duplicate(this.skills.filter(item => item.system.isshieldskill))
|
||||
|
||||
const rollTables = await MaleficesUtility.loadCompendium("fvtt-malefices.rolltables")
|
||||
this.rollTables = rollTables.map(i => i.toObject())
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async loadCompendiumData(compendium) {
|
||||
const pack = game.packs.get(compendium)
|
||||
return await pack?.getDocuments() ?? []
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async loadCompendium(compendium, filter = item => true) {
|
||||
let compendiumData = await MaleficesUtility.loadCompendiumData(compendium)
|
||||
return compendiumData.filter(filter)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isArmorLight(armor) {
|
||||
if (armor && (armor.system.armortype.includes("light") || armor.system.armortype.includes("clothes"))) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async chatListeners(html) {
|
||||
|
||||
html.on("click", '.view-item-from-chat', event => {
|
||||
game.system.Malefices.creator.openItemView(event)
|
||||
})
|
||||
html.on("click", '.roll-defense-melee', event => {
|
||||
let rollId = $(event.currentTarget).data("roll-id")
|
||||
let rollData = MaleficesUtility.getRollData(rollId)
|
||||
rollData.defenseWeaponId = $(event.currentTarget).data("defense-weapon-id")
|
||||
let actor = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
||||
if (actor && (game.user.isGM || actor.isOwner)) {
|
||||
actor.rollDefenseMelee(rollData)
|
||||
}
|
||||
})
|
||||
html.on("click", '.roll-defense-ranged', event => {
|
||||
let rollId = $(event.currentTarget).data("roll-id")
|
||||
let rollData = MaleficesUtility.getRollData(rollId)
|
||||
let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
||||
if (defender && (game.user.isGM || defender.isOwner)) {
|
||||
defender.rollDefenseRanged(rollData)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async preloadHandlebarsTemplates() {
|
||||
|
||||
const templatePaths = [
|
||||
'systems/fvtt-malefices/templates/actors/editor-notes-gm.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-item-nav.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-item-description.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-common-item-fields.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-damage-types.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-weapon-types.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-weapon-categories.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-attributes.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-equipment-types.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-armor-types.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-spell-types.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-spell-levels.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-spell-schools.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-focus-bond.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-focus-treatment.hbs',
|
||||
'systems/fvtt-malefices/templates/items/partial-options-focus-core.hbs',
|
||||
]
|
||||
return loadTemplates(templatePaths);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static removeChatMessageId(messageId) {
|
||||
if (messageId) {
|
||||
game.messages.get(messageId)?.delete();
|
||||
}
|
||||
}
|
||||
|
||||
static findChatMessageId(current) {
|
||||
return MaleficesUtility.getChatMessageId(MaleficesUtility.findChatMessage(current));
|
||||
}
|
||||
|
||||
static getChatMessageId(node) {
|
||||
return node?.attributes.getNamedItem('data-message-id')?.value;
|
||||
}
|
||||
|
||||
static findChatMessage(current) {
|
||||
return MaleficesUtility.findNodeMatching(current, it => it.classList.contains('chat-message') && it.attributes.getNamedItem('data-message-id'));
|
||||
}
|
||||
|
||||
static findNodeMatching(current, predicate) {
|
||||
if (current) {
|
||||
if (predicate(current)) {
|
||||
return current;
|
||||
}
|
||||
return MaleficesUtility.findNodeMatching(current.parentElement, predicate);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createDirectOptionList(min, max) {
|
||||
let options = {};
|
||||
for (let i = min; i <= max; i++) {
|
||||
options[`${i}`] = `${i}`;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static buildListOptions(min, max) {
|
||||
let options = ""
|
||||
for (let i = min; i <= max; i++) {
|
||||
options += `<option value="${i}">${i}</option>`
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getTarget() {
|
||||
if (game.user.targets) {
|
||||
for (let target of game.user.targets) {
|
||||
return target
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateRollData(rollData) {
|
||||
|
||||
let id = rollData.rollId
|
||||
let oldRollData = this.rollDataStore[id] || {}
|
||||
let newRollData = mergeObject(oldRollData, rollData)
|
||||
this.rollDataStore[id] = newRollData
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static saveRollData(rollData) {
|
||||
game.socket.emit("system.fvtt-malefices", {
|
||||
name: "msg_update_roll", data: rollData
|
||||
}); // Notify all other clients of the roll
|
||||
this.updateRollData(rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getRollData(id) {
|
||||
return this.rollDataStore[id]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async displayDefenseMessage(rollData) {
|
||||
if (rollData.mode == "weapon" && rollData.defenderTokenId) {
|
||||
let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
||||
if (game.user.isGM || (game.user.character && game.user.character.id == defender.id)) {
|
||||
rollData.defender = defender
|
||||
rollData.defenderWeapons = defender.getEquippedWeapons()
|
||||
rollData.isRangedAttack = rollData.weapon?.system.isranged
|
||||
this.createChatWithRollMode(defender.name, {
|
||||
name: defender.name,
|
||||
alias: defender.name,
|
||||
//user: defender.id,
|
||||
content: await renderTemplate(`systems/fvtt-malefices/templates/chat-request-defense.html`, rollData),
|
||||
whisper: [defender.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getSuccessResult(rollData) {
|
||||
if (rollData.sumSuccess <= -3) {
|
||||
if (rollData.attackRollData.weapon.system.isranged) {
|
||||
return { result: "miss", fumble: true, hpLossType: "melee" }
|
||||
} else {
|
||||
return { result: "miss", fumble: true, attackerHPLoss: "2d3", hpLossType: "melee" }
|
||||
}
|
||||
}
|
||||
if (rollData.sumSuccess == -2) {
|
||||
if (rollData.attackRollData.weapon.system.isranged) {
|
||||
return { result: "miss", dangerous_fumble: true }
|
||||
} else {
|
||||
return { result: "miss", dangerous_fumble: true, attackerHPLoss: "1d3", hpLossType: "melee" }
|
||||
}
|
||||
}
|
||||
if (rollData.sumSuccess == -1) {
|
||||
return { result: "miss" }
|
||||
}
|
||||
if (rollData.sumSuccess == 0) {
|
||||
if (rollData.attackRollData.weapon.system.isranged) {
|
||||
return { result: "target_space", aoe: true }
|
||||
} else {
|
||||
return { result: "clash", hack_vs_shields: true }
|
||||
}
|
||||
}
|
||||
if (rollData.sumSuccess == 1) {
|
||||
return { result: "hit", defenderDamage: "1", entangle: true, knockback: true }
|
||||
}
|
||||
if (rollData.sumSuccess == 2) {
|
||||
return { result: "hit", defenderDamage: "2", critical_1: true, entangle: true, knockback: true, penetrating_impale: true, hack_armors: true }
|
||||
}
|
||||
if (rollData.sumSuccess >= 3) {
|
||||
return { result: "hit", defenderDamage: "3", critical_2: true, entangle: true, knockback: true, penetrating_impale: true, hack_armors: true }
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getFumble(weapon) {
|
||||
const pack = game.packs.get("fvtt-malefices.rolltables")
|
||||
const index = await pack.getIndex()
|
||||
let entry
|
||||
|
||||
if (weapon.isranged) {
|
||||
entry = index.find(e => e.name === "Fumble! (ranged)")
|
||||
}
|
||||
if (!weapon.isranged) {
|
||||
entry = index.find(e => e.name === "Fumble! (melee)")
|
||||
}
|
||||
let table = await pack.getDocument(entry._id)
|
||||
const draw = await table.draw({ displayChat: false, rollMode: "gmroll" })
|
||||
return draw.results.length > 0 ? draw.results[0] : undefined
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async processSuccessResult(rollData) {
|
||||
if (game.user.isGM) { // Only GM process this
|
||||
let result = rollData.successDetails
|
||||
let attacker = game.actors.get(rollData.actorId)
|
||||
let defender = game.canvas.tokens.get(rollData.attackRollData.defenderTokenId).actor
|
||||
|
||||
if (attacker && result.attackerHPLoss) {
|
||||
result.attackerHPLossValue = await attacker.incDecHP("-" + result.attackerHPLoss)
|
||||
}
|
||||
if (attacker && defender && result.defenderDamage) {
|
||||
let dmgDice = (rollData.attackRollData.weapon.system.isranged) ? "d6" : "d8"
|
||||
result.damageWeaponFormula = result.defenderDamage + dmgDice
|
||||
result.defenderHPLossValue = await defender.incDecHP("-" + result.damageWeaponFormula)
|
||||
}
|
||||
if (result.fumble || (result.dangerous_fumble && MaleficesUtility.isWeaponDangerous(rollData.attackRollData.weapon))) {
|
||||
result.fumbleDetails = await this.getFumble(rollData.weapon)
|
||||
}
|
||||
if (result.critical_1 || result.critical_2) {
|
||||
let isDeadly = MaleficesUtility.isWeaponDeadly(rollData.attackRollData.weapon)
|
||||
result.critical = await this.getCritical((result.critical_1) ? "I" : "II", rollData.attackRollData.weapon)
|
||||
result.criticalText = result.critical.text
|
||||
}
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-malefices/templates/chat-attack-defense-result.html`, rollData)
|
||||
})
|
||||
console.log("Results processed", rollData)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async processAttackDefense(rollData) {
|
||||
if (rollData.attackRollData) {
|
||||
//console.log("Defender token, ", rollData, rollData.defenderTokenId)
|
||||
let defender = game.canvas.tokens.get(rollData.attackRollData.defenderTokenId).actor
|
||||
let sumSuccess = rollData.attackRollData.nbSuccess - rollData.nbSuccess
|
||||
if (sumSuccess > 0) {
|
||||
let armorResult = await defender.rollArmorDie(rollData)
|
||||
rollData.armorResult = armorResult
|
||||
sumSuccess += rollData.armorResult.nbSuccess
|
||||
if (sumSuccess < 0) { // Never below 0
|
||||
sumSuccess = 0
|
||||
}
|
||||
}
|
||||
rollData.sumSuccess = sumSuccess
|
||||
rollData.successDetails = this.getSuccessResult(rollData)
|
||||
if (game.user.isGM) {
|
||||
this.processSuccessResult(rollData)
|
||||
} else {
|
||||
game.socket.emit("system.fvtt-malefices", { msg: "msg_gm_process_attack_defense", data: rollData });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async onSocketMesssage(msg) {
|
||||
console.log("SOCKET MESSAGE", msg.name)
|
||||
if (msg.name == "msg_update_roll") {
|
||||
this.updateRollData(msg.data)
|
||||
}
|
||||
if (msg.name == "msg_gm_process_attack_defense") {
|
||||
this.processSuccessResult(msg.data)
|
||||
}
|
||||
if (msg.name == "msg_gm_item_drop" && game.user.isGM) {
|
||||
let actor = game.actors.get(msg.data.actorId)
|
||||
let item
|
||||
if (msg.data.isPack) {
|
||||
item = await fromUuid("Compendium." + msg.data.isPack + "." + msg.data.itemId)
|
||||
} else {
|
||||
item = game.items.get(msg.data.itemId)
|
||||
}
|
||||
this.addItemDropToActor(actor, item)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static computeFocusData(focus) {
|
||||
let focusData = {
|
||||
focusPoints: __focusCore[focus.core] + __focusPointTreatment[focus.treatment],
|
||||
burnChance: __burnChanceTreatment[focus.treatment],
|
||||
focusRegen: __focusRegenBond[focus.bond],
|
||||
spellAttackBonus: __bonusSpellAttackBond[focus.bond],
|
||||
spellDamageBonus: __bonusSpellDamageBond[focus.bond]
|
||||
}
|
||||
return focusData
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async searchItem(dataItem) {
|
||||
let item
|
||||
if (dataItem.pack) {
|
||||
let id = dataItem.id || dataItem._id
|
||||
let items = await this.loadCompendium(dataItem.pack, item => item.id == id)
|
||||
item = items[0] || undefined
|
||||
} else {
|
||||
item = game.items.get(dataItem.id)
|
||||
}
|
||||
return item
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getSpellCost(spell) {
|
||||
return __spellCost[spell.system.level]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getArmorPenalty( item ) {
|
||||
if (item && (item.type == "shield" || item.type == "armor")) {
|
||||
return __armorPenalties[item.system.category]
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
rollMode: modeOverride || game.settings.get("core", "rollMode"),
|
||||
content: content
|
||||
};
|
||||
|
||||
if (["gmroll", "blindroll"].includes(chatData.rollMode)) chatData["whisper"] = ChatMessage.getWhisperRecipients("GM").map(u => u.id);
|
||||
if (chatData.rollMode === "blindroll") chatData["blind"] = true;
|
||||
else if (chatData.rollMode === "selfroll") chatData["whisper"] = [game.user];
|
||||
|
||||
if (forceWhisper) { // Final force !
|
||||
chatData["speaker"] = ChatMessage.getSpeaker();
|
||||
chatData["whisper"] = ChatMessage.getWhisperRecipients(forceWhisper);
|
||||
}
|
||||
|
||||
return chatData;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async showDiceSoNice(roll, rollMode) {
|
||||
if (game.modules.get("dice-so-nice")?.active) {
|
||||
if (game.dice3d) {
|
||||
let whisper = null;
|
||||
let blind = false;
|
||||
rollMode = rollMode ?? game.settings.get("core", "rollMode");
|
||||
switch (rollMode) {
|
||||
case "blindroll": //GM only
|
||||
blind = true;
|
||||
case "gmroll": //GM + rolling player
|
||||
whisper = this.getUsers(user => user.isGM);
|
||||
break;
|
||||
case "roll": //everybody
|
||||
whisper = this.getUsers(user => user.active);
|
||||
break;
|
||||
case "selfroll":
|
||||
whisper = [game.user.id];
|
||||
break;
|
||||
}
|
||||
await game.dice3d.showForRoll(roll, game.user, true, whisper, blind);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateSkill(skill) {
|
||||
skill.system.level = skill.system.background + skill.system.basic + skill.system.class + skill.system.explevel
|
||||
if (skill.system.level > 7) { skill.system.level = 7 }
|
||||
skill.system.skilldice = __skillLevel2Dice[skill.system.level]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getDiceFromCover(cover) {
|
||||
if (cover == "cover50") return 1
|
||||
return 0
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getDiceFromSituational(cover) {
|
||||
if (cover == "prone") return 1
|
||||
if (cover == "dodge") return 1
|
||||
if (cover == "moving") return 1
|
||||
if (cover == "engaged") return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async rollMalefices(rollData) {
|
||||
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
|
||||
// Build the dice formula
|
||||
let diceFormula = "1d12"
|
||||
if (rollData.skill) {
|
||||
diceFormula += "+" + rollData.skill.finalvalue
|
||||
}
|
||||
if (rollData.crafting) {
|
||||
diceFormula += "+" + rollData.crafting.system.level
|
||||
}
|
||||
if (rollData.spellAttack) {
|
||||
diceFormula += "+" + rollData.spellAttack
|
||||
}
|
||||
diceFormula += "+" + rollData.bonusMalusRoll
|
||||
|
||||
if (rollData.skill && rollData.skill.good) {
|
||||
diceFormula += "+1d4"
|
||||
}
|
||||
if (rollData.weapon ) {
|
||||
diceFormula += "+" + rollData.weapon.attackBonus
|
||||
}
|
||||
rollData.diceFormula = diceFormula
|
||||
|
||||
// Performs roll
|
||||
console.log("Roll formula", diceFormula)
|
||||
let myRoll = rollData.roll
|
||||
if (!myRoll) { // New rolls only of no rerolls
|
||||
myRoll = new Roll(diceFormula).roll({ async: false })
|
||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||
}
|
||||
rollData.roll = myRoll
|
||||
|
||||
rollData.isSuccess = false
|
||||
if (rollData.targetCheck != "none") {
|
||||
if (myRoll.total >= Number(rollData.targetCheck)) {
|
||||
rollData.isSuccess = true
|
||||
}
|
||||
}
|
||||
|
||||
if (rollData.spell) {
|
||||
actor.spentFocusPoints(rollData.spell)
|
||||
}
|
||||
|
||||
let msg = await this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-malefices/templates/chat/chat-generic-result.hbs`, rollData)
|
||||
})
|
||||
msg.setFlag("world", "rolldata", rollData)
|
||||
if (rollData.skillKey == "initiative") {
|
||||
console.log("REGISTERED")
|
||||
actor.setFlag("world", "initiative", myRoll.total)
|
||||
}
|
||||
|
||||
console.log("Rolldata result", rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static sortArrayObjectsByName(myArray) {
|
||||
myArray.sort((a, b) => {
|
||||
let fa = a.name.toLowerCase();
|
||||
let fb = b.name.toLowerCase();
|
||||
if (fa < fb) {
|
||||
return -1;
|
||||
}
|
||||
if (fa > fb) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getUsers(filter) {
|
||||
return game.users.filter(filter).map(user => user.id);
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getWhisperRecipients(rollMode, name) {
|
||||
switch (rollMode) {
|
||||
case "blindroll": return this.getUsers(user => user.isGM);
|
||||
case "gmroll": return this.getWhisperRecipientsAndGMs(name);
|
||||
case "selfroll": return [game.user.id];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getWhisperRecipientsAndGMs(name) {
|
||||
let recep1 = ChatMessage.getWhisperRecipients(name) || [];
|
||||
return recep1.concat(ChatMessage.getWhisperRecipients('GM'));
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static blindMessageToGM(chatOptions) {
|
||||
let chatGM = duplicate(chatOptions);
|
||||
chatGM.whisper = this.getUsers(user => user.isGM);
|
||||
chatGM.content = "Blinde message of " + game.user.name + "<br>" + chatOptions.content;
|
||||
console.log("blindMessageToGM", chatGM);
|
||||
game.socket.emit("system.fvtt-malefices", { msg: "msg_gm_chat_message", data: chatGM });
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static split3Columns(data) {
|
||||
|
||||
let array = [[], [], []];
|
||||
if (data == undefined) return array;
|
||||
|
||||
let col = 0;
|
||||
for (let key in data) {
|
||||
let keyword = data[key];
|
||||
keyword.key = key; // Self-reference
|
||||
array[col].push(keyword);
|
||||
col++;
|
||||
if (col == 3) col = 0;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createChatMessage(name, rollMode, chatOptions) {
|
||||
switch (rollMode) {
|
||||
case "blindroll": // GM only
|
||||
if (!game.user.isGM) {
|
||||
this.blindMessageToGM(chatOptions);
|
||||
|
||||
chatOptions.whisper = [game.user.id];
|
||||
chatOptions.content = "Message only to the GM";
|
||||
}
|
||||
else {
|
||||
chatOptions.whisper = this.getUsers(user => user.isGM);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
chatOptions.whisper = this.getWhisperRecipients(rollMode, name);
|
||||
break;
|
||||
}
|
||||
chatOptions.alias = chatOptions.alias || name;
|
||||
return ChatMessage.create(chatOptions);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getBasicRollData() {
|
||||
let rollData = {
|
||||
rollId: randomID(16),
|
||||
bonusMalusRoll: 0,
|
||||
targetCheck: "none",
|
||||
rollMode: game.settings.get("core", "rollMode")
|
||||
}
|
||||
MaleficesUtility.updateWithTarget(rollData)
|
||||
return rollData
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateWithTarget(rollData) {
|
||||
let target = MaleficesUtility.getTarget()
|
||||
if (target) {
|
||||
rollData.defenderTokenId = target.id
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createChatWithRollMode(name, chatOptions) {
|
||||
return this.createChatMessage(name, game.settings.get("core", "rollMode"), chatOptions)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async confirmDelete(actorSheet, li) {
|
||||
let itemId = li.data("item-id");
|
||||
let msgTxt = "<p>Are you sure to remove this Item ?";
|
||||
let buttons = {
|
||||
delete: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: "Yes, remove it",
|
||||
callback: () => {
|
||||
actorSheet.actor.deleteEmbeddedDocuments("Item", [itemId]);
|
||||
li.slideUp(200, () => actorSheet.render(false));
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: "Cancel"
|
||||
}
|
||||
}
|
||||
msgTxt += "</p>";
|
||||
let d = new Dialog({
|
||||
title: "Confirm removal",
|
||||
content: msgTxt,
|
||||
buttons: buttons,
|
||||
default: "cancel"
|
||||
});
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
}
|
1356
styles/simple.css
Normal file
43
system.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"description": "Maléfices, Le Jeu de Rôle",
|
||||
"esmodules": [
|
||||
"modules/malefices-main.js"
|
||||
],
|
||||
"gridDistance": 1,
|
||||
"gridUnits": "u",
|
||||
"languages": [
|
||||
{
|
||||
"lang": "fr",
|
||||
"name": "French",
|
||||
"path": "lang/fr.json",
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Uberwald",
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"license": "LICENSE.txt",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/fvtt-malefices/raw/branch/master/system.json",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "10",
|
||||
"maximum": "10"
|
||||
},
|
||||
"id": "fvtt-malefices",
|
||||
"primaryTokenAttribute": "secondary.health",
|
||||
"secondaryTokenAttribute": "secondary.delirium",
|
||||
"socket": true,
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"packs": [
|
||||
],
|
||||
"title": "Maléfices, le Jeu de Rôle",
|
||||
"url": "https://www.uberwald.me/gitea/public/fvtt-malefices",
|
||||
"version": "10.0.0",
|
||||
"download": "https://www.uberwald.me/gitea/public/fvtt-malefices/archive/fvtt-malefices-v10.0.0.zip",
|
||||
"background": "systems/fvtt-malefices/images/ui/malefice_welcome_page.webp"
|
||||
}
|
109
template.json
Normal file
@ -0,0 +1,109 @@
|
||||
{
|
||||
"Actor": {
|
||||
"types": [
|
||||
"personnage",
|
||||
"pnj"
|
||||
],
|
||||
"templates": {
|
||||
"biodata": {
|
||||
"biodata": {
|
||||
"age": 0,
|
||||
"size": "",
|
||||
"lieunaissance": "",
|
||||
"nationalite": "",
|
||||
"profession": "",
|
||||
"residence": "",
|
||||
"milieusocial": "",
|
||||
"poids": "",
|
||||
"cheveux": "",
|
||||
"sexe": "",
|
||||
"yeux": "",
|
||||
"enfance": "",
|
||||
"adulte": "",
|
||||
"loisirs": "",
|
||||
"singularite": "",
|
||||
"politique": "",
|
||||
"religion": "",
|
||||
"fantastique": "",
|
||||
"description": "",
|
||||
"gmnotes": ""
|
||||
}
|
||||
},
|
||||
"core": {
|
||||
"subactors": [],
|
||||
"lamesdestin": [],
|
||||
"pointdestin": 1,
|
||||
"fluide": 5,
|
||||
"attributs": {
|
||||
"constitution": {
|
||||
"label": "Constitution",
|
||||
"abbrev": "constitution",
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"physique": {
|
||||
"label": "Aptitudes Physiques",
|
||||
"abbrev": "physique",
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"culturegenerale": {
|
||||
"label": "Culture Générale",
|
||||
"abbrev": "culturegenerale",
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"habilite": {
|
||||
"label": "Habilité",
|
||||
"abbrev": "habilite",
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"perception": {
|
||||
"label": "Perception",
|
||||
"abbrev": "habilite",
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"spiritualite": {
|
||||
"label": "Spiritualite",
|
||||
"abbrev": "spiritualite",
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"rationnalite": {
|
||||
"label": "Rationnalite",
|
||||
"abbrev": "rationnalite",
|
||||
"value": 0,
|
||||
"max": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"npccore": {
|
||||
"npctype": "",
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"personnage": {
|
||||
"templates": [
|
||||
"biodata",
|
||||
"core"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Item": {
|
||||
"types": [
|
||||
"arme"
|
||||
],
|
||||
"templates": {
|
||||
},
|
||||
"arme" : {
|
||||
"armetype": 0,
|
||||
"dommagenormale": 0,
|
||||
"dommagepart": 0,
|
||||
"dommagecritique": 0,
|
||||
"dommagecritiqueKO": false,
|
||||
"dommagecritiquemort": false
|
||||
}
|
||||
}
|
||||
}
|
626
templates/actors/actor-sheet.hbs
Normal file
@ -0,0 +1,626 @@
|
||||
<form class="{{cssClass}}" autocomplete="off">
|
||||
|
||||
{{!-- Sheet Header --}}
|
||||
<header class="sheet-header">
|
||||
<div class="header-fields">
|
||||
<h1 class="charname margin-right"><input name="name" type="text" value="{{name}}" placeholder="Name" /></h1>
|
||||
<div class="flexrow">
|
||||
<img class="profile-img" src="{{img}}" data-edit="img" title="{{name}}" />
|
||||
<div class="flexcol">
|
||||
|
||||
<div class="flexrow">
|
||||
{{#each system.attributes as |attr attrKey|}}
|
||||
<div class="flexcol">
|
||||
<div class="flexrow flexrow-no-expand">
|
||||
<span class="attribute-label">{{attr.label}}</span>
|
||||
<input type="text" class="item-field-label-short" name="system.attributes.{{attrKey}}.value" value="{{attr.value}}" data-dtype="Number"/>
|
||||
</div>
|
||||
{{#each attr.skills as |skill skillKey|}}
|
||||
<div class="flexrow flexrow-no-expand">
|
||||
<span class="item-field-skill skill-label">
|
||||
<a class="roll-skill" data-attr-key="{{attrKey}}" data-skill-key="{{skillKey}}">
|
||||
<i class="fa-solid fa-dice-d12"></i> {{upperFirst skillKey}} {{skill.finalvalue}}</a>
|
||||
</span>
|
||||
<input type="checkbox" class="skill-good-checkbox" name="system.attributes.{{attrKey}}.skills.{{skillKey}}.good" {{checked skill.good}} />
|
||||
</div>
|
||||
{{/each}}
|
||||
<div class="flexrow flexrow-no-expand">
|
||||
<span class="attribute-label"> </span>
|
||||
</div>
|
||||
{{#if (eq attrKey "might")}}
|
||||
<div class="flexrow flexrow-no-expand">
|
||||
<span class="attribute-label">Universal</span>
|
||||
</div>
|
||||
{{#each @root.system.universal.skills as |skill skillKey|}}
|
||||
<div class="flexrow flexrow-no-expand">
|
||||
<span class="item-field-skill skill-label">
|
||||
<a class="roll-universal" data-skill-key="{{skillKey}}">
|
||||
<i class="fa-solid fa-dice-d12"></i> {{upperFirst skillKey}}
|
||||
</a>
|
||||
</span>
|
||||
<input type="text" class="item-input-small" name="system.universal.skills.{{skillKey}}.finalvalue" value="{{skill.finalvalue}}" data-dtype="Number"/>
|
||||
</div>
|
||||
{{/each}}
|
||||
{{else}}
|
||||
<div class="flexrow">
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/each}}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{{!-- Sheet Tab Navigation --}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
<a class="item" data-tab="main">Main</a>
|
||||
<a class="item" data-tab="modules">Modules</a>
|
||||
<a class="item" data-tab="spells">Spells</a>
|
||||
<a class="item" data-tab="moves">Moves</a>
|
||||
<a class="item" data-tab="traits">Traits</a>
|
||||
<a class="item" data-tab="equipment">Equipment</a>
|
||||
<a class="item" data-tab="crafting">Crafting</a>
|
||||
<a class="item" data-tab="biodata">Biography</a>
|
||||
</nav>
|
||||
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
|
||||
{{!-- Skills Tab --}}
|
||||
<div class="tab main" data-group="primary" data-tab="main">
|
||||
|
||||
<ul class="stat-list alternate-list item-list">
|
||||
<li class="item flexrow list-item">
|
||||
<span class="item-name-label-header-short">Level</span>
|
||||
<input type="text" class="item-field-label-short" name="system.level.value" value="{{system.level.value}}" data-dtype="Number"/>
|
||||
|
||||
<span class="item-name-label-header-short"> </span>
|
||||
|
||||
<span class="item-name-label-header-short">Health</span>
|
||||
<input type="text" class="item-field-label-short" name="system.health.value" value="{{system.health.value}}" data-dtype="Number"/> /
|
||||
<input type="text" class="item-field-label-short" name="system.health.max" value="{{system.health.max}}" data-dtype="Number" disabled/>
|
||||
|
||||
<span class="item-name-label-header-medium"> </span>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="grid-2col">
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header-long">
|
||||
<h3><label class="items-title-text">Mitigations</label></h3>
|
||||
</span>
|
||||
</li>
|
||||
{{#each system.mitigation as |mitigation key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-mitigation-id="{{key}}">
|
||||
<span class="item-name-label-medium">{{mitigation.label}}</span>
|
||||
<span class="item-name-label-short">{{mitigation.value}}</span>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header-long">
|
||||
<h3><label class="items-title-text">Bonuses</label></h3>
|
||||
</span>
|
||||
</li>
|
||||
{{#each system.bonus as |bonus key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-bonus-id="{{key}}">
|
||||
<span class="item-name-label-medium">{{upperFirst key}}</span>
|
||||
<ul class="ul-level1">
|
||||
{{#each bonus as |value key2|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-bonus-id="{{key}}">
|
||||
<span class="item-name-label-short">{{upperFirst key2}}</span>
|
||||
<span class="item-name-label-short">{{value}}</span>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{!-- Modules Tab --}}
|
||||
<div class="tab modules" data-group="primary" data-tab="modules">
|
||||
|
||||
<div class="flexcol">
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header-long">
|
||||
<h3><label class="items-title-text">Modules</label></h3>
|
||||
</span>
|
||||
</li>
|
||||
{{#each modules as |module key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-item-id="{{module._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{module.img}}" /></a>
|
||||
<span class="item-name-label-long"><a class ="item-edit">{{module.name}}</a></span>
|
||||
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{{!-- Spells Tab --}}
|
||||
<div class="tab spells" data-group="primary" data-tab="spells">
|
||||
|
||||
<div class="flexcol">
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item">
|
||||
<span class="item-name-label-header-short">Focus Regen</span>
|
||||
<input type="text" class="item-field-label-short" value="{{system.focus.focusregen}}" data-dtype="Number" disabled/>
|
||||
|
||||
|
||||
<span class="item-name-label-header-short"> </span>
|
||||
|
||||
<span class="item-name-label-header-short">Focus Points</span>
|
||||
<input type="text" class="item-field-label-short" name="system.focus.currentfocuspoints" value="{{system.focus.currentfocuspoints}}" data-dtype="Number"/> /
|
||||
<input type="text" class="item-field-label-short" value="{{system.focus.focuspoints}}" data-dtype="Number" disabled/>
|
||||
|
||||
<span class="item-name-label-header-medium"> </span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Name</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Type</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Level</label>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
{{#each spells as |spell key|}}
|
||||
<li class="item stat flexrow list-item list-item-shadow" data-item-id="{{spell._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{spell.img}}" /></a>
|
||||
<span class="item-name-label">
|
||||
<a class="roll-spell"><i class="fa-solid fa-dice-d12"> </i>{{spell.name}}</a>
|
||||
</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.spelltype}}</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.level}}</span>
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{!-- moves Tab --}}
|
||||
<div class="tab moves" data-group="primary" data-tab="moves">
|
||||
|
||||
<div class="flexcol">
|
||||
|
||||
<ul class="item-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header item-name-label-header-long2">
|
||||
<h3><label class="item-name-label-header-long2">Equipped Weapons</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-long">
|
||||
<label class="short-label">Damage</label>
|
||||
</span>
|
||||
<span class="item-field-label-long">
|
||||
<label class="short-label">Critical</label>
|
||||
</span>
|
||||
<span class="item-field-label-long">
|
||||
<label class="short-label">Brutal</label>
|
||||
</span>
|
||||
</li>
|
||||
{{#each equippedWeapons as |weapon key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-item-id="{{weapon._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{weapon.img}}" /></a>
|
||||
<span class="item-name-label-long2"><a class="roll-weapon"><i class="fa-solid fa-dice-d12"></i>{{weapon.name}}</a></span>
|
||||
<span class="item-field-label-long"><label><a class="roll-weapon-damage" data-damage="normal"><i class="fa-solid fa-dice-d12"></i>{{weapon.system.damages.primary.normal}}</label></a></span>
|
||||
<span class="item-field-label-long"><label><a class="roll-weapon-damage" data-damage="critical"><i class="fa-solid fa-dice-d12"></i>{{weapon.system.damages.primary.critical}}</label></a></span>
|
||||
<span class="item-field-label-long"><label><a class="roll-weapon-damage" data-damage="brutal"><i class="fa-solid fa-dice-d12"></i>{{weapon.system.damages.primary.brutal}}</label></a></span>
|
||||
<div class="item-filler"> </div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Name</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Type</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Level</label>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
{{#each spells as |spell key|}}
|
||||
<li class="item stat flexrow list-item list-item-shadow" data-item-id="{{spell._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{spell.img}}" /></a>
|
||||
<span class="item-name-label">
|
||||
<a class="spell-roll">{{spell.name}}</a>
|
||||
</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.spelltype}}</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.level}}</span>
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{!-- traits Tab --}}
|
||||
<div class="tab traits" data-group="primary" data-tab="traits">
|
||||
|
||||
<div class="flexcol">
|
||||
|
||||
<ul class="stat-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Name</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Type</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Level</label>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
{{#each traits as |trait key|}}
|
||||
<li class="item stat flexrow list-item list-item-shadow" data-item-id="{{trait._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{trait.img}}" /></a>
|
||||
<span class="item-name-label">
|
||||
<a class="spell-roll">{{trait.name}}</a>
|
||||
</span>
|
||||
<span class="item-field-label-medium">{{upperFirst trait.system.spelltype}}</span>
|
||||
<span class="item-field-label-medium">{{upperFirst trait.system.level}}</span>
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{!-- Equipement Tab --}}
|
||||
<div class="tab equipment" data-group="primary" data-tab="equipment">
|
||||
|
||||
<div class="flexrow">
|
||||
<h3>Encumbrance</h3>
|
||||
<span class="small-label">Current : {{encCurrent}}</span>
|
||||
<span class="small-label">Capacity : {{encCapacity}}</span>
|
||||
</div>
|
||||
|
||||
<ul class="item-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Money</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-long">
|
||||
<label class="short-label">Qty</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Weight</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">IDR</label>
|
||||
</span>
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-add" data-type="money" title="Create Item"><i class="fas fa-plus"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{#each moneys as |money key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-item-id="{{money._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{money.img}}" /></a>
|
||||
<span class="item-name-label">{{money.name}}</span>
|
||||
|
||||
<span class="item-field-label-long"><label>
|
||||
{{money.system.quantity}}
|
||||
(<a class="quantity-minus plus-minus-button"> -</a>/<a class="quantity-plus plus-minus-button">+</a>)
|
||||
</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label>{{money.system.weight}}</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
{{#if money.system.idrDice}}
|
||||
<a class="roll-idr" data-dice-value="{{money.data.idrDice}}">{{money.system.idrDice}}</a>
|
||||
{{else}}
|
||||
-
|
||||
{{/if}}
|
||||
</span>
|
||||
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<ul class="item-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Weapons</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Attack</label>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Damage</label>
|
||||
</span>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-add" data-type="weapon" title="Create Item"><i class="fas fa-plus"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{#each weapons as |weapon key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-item-id="{{weapon._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{weapon.img}}" /></a>
|
||||
<span class="item-name-label">{{weapon.name}}</span>
|
||||
<span class="item-field-label-short"><label>{{upperFirst weapon.system.ability}}</label></span>
|
||||
<span class="item-field-label-short"><label>{{upperFirst weapon.system.damage}}</label></span>
|
||||
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-equip" title="Worn">{{#if weapon.system.equipped}}<i
|
||||
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<ul class="item-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Armors</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Type</label>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Absorption</label>
|
||||
</span>
|
||||
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-add" data-type="armor" title="Create Item"><i class="fas fa-plus"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{#each armors as |armor key|}}
|
||||
<li class="item list-item flexrow list-item-shadow" data-item-id="{{armor._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{armor.img}}" /></a>
|
||||
<span class="item-name-label">{{armor.name}}</span>
|
||||
<span class="item-field-label-short">{{upperFirst armor.system.armortype}}</span>
|
||||
<span class="item-field-label-short">{{armor.system.absorprionroll}}</span>
|
||||
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-equip" title="Worn">{{#if armor.system.equipped}}<i
|
||||
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<ul class="item-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Shields</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Dice</label>
|
||||
</span>
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-add" data-type="shield" title="Create Item"><i class="fas fa-plus"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{#each shields as |shield key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-item-id="{{shield._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{shield.img}}" /></a>
|
||||
<span class="item-name-label">{{shield.name}}</span>
|
||||
<span class="item-field-label-short">{{shield.system.levelDice}}</span>
|
||||
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-equip" title="Worn">{{#if shield.system.equipped}}<i
|
||||
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<ul class="item-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Equipment</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-long">
|
||||
<label class="short-label">Qty</label>
|
||||
</span>
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-add" data-type="equipment" title="Create Item"><i class="fas fa-plus"></i></a>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
{{#each equipments as |equip key|}}
|
||||
<li class="item list-item flexrow list-item-shadow" data-item-id="{{equip._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{equip.img}}" /></a>
|
||||
<span class="item-name-label">{{equip.name}}</span>
|
||||
|
||||
<span class="item-field-label-long"><label>
|
||||
{{equip.system.quantity}}
|
||||
(<a class="quantity-minus plus-minus-button"> -</a>/<a class="quantity-plus plus-minus-button">+</a>)
|
||||
</label>
|
||||
</span>
|
||||
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-equip" title="Worn">{{#if equip.system.equipped}}<i
|
||||
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
</div>
|
||||
|
||||
{{!-- Equipement Tab --}}
|
||||
<div class="tab crafting" data-group="primary" data-tab="crafting">
|
||||
|
||||
|
||||
<ul class="item-list alternate-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Crafting</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Level</label>
|
||||
</span>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-add" data-type="weapon" title="Create Item"><i class="fas fa-plus"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{#each craftingSkills as |crafting key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-item-id="{{crafting._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{crafting.img}}" /></a>
|
||||
<span class="item-name-label"> <a class="roll-crafting"><i class="fa-solid fa-dice-d12"> </i>{{crafting.name}}</a></span>
|
||||
<span class="item-field-label-short"><label>{{crafting.system.level}}</label></span>
|
||||
|
||||
<div class="item-filler"> </div>
|
||||
<div class="item-controls item-controls-fixed">
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
{{!-- Biography Tab --}}
|
||||
<div class="tab biodata" data-group="primary" data-tab="biodata">
|
||||
<div class="grid grid-2col">
|
||||
<div>
|
||||
<ul class="item-list alternate-list">
|
||||
<li class="item flexrow">
|
||||
<label class="generic-label">Origin</label>
|
||||
<input type="text" class="" name="system.biodata.origin" value="{{data.biodata.origin}}"
|
||||
data-dtype="String" />
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label class="generic-label">Age</label>
|
||||
<input type="text" class="" name="system.biodata.age" value="{{data.biodata.age}}" data-dtype="String" />
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label class="generic-label">Height</label>
|
||||
<input type="text" class="" name="system.biodata.height" value="{{data.biodata.height}}" data-dtype="String" />
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label class="generic-label">Eyes</label>
|
||||
<input type="text" class="" name="system.biodata.eyes" value="{{data.biodata.eyes}}" data-dtype="String" />
|
||||
</li>
|
||||
<li class="item flexrow">
|
||||
<label class="generic-label">Hair</label>
|
||||
<input type="text" class="" name="system.biodata.hair" value="{{data.biodata.hair}}" data-dtype="String" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<ul>
|
||||
<li class="flexrow item">
|
||||
<label class="generic-label">Size</label>
|
||||
<select class="competence-base flexrow" type="text" name="system.biodata.size" value="{{data.biodata.size}}" data-dtype="Number">
|
||||
{{#select data.biodata.size}}
|
||||
<option value="1">Tiny</option>
|
||||
<option value="2">Small</option>
|
||||
<option value="3">Medium</option>
|
||||
<option value="4">Large</option>
|
||||
<option value="5">Huge</option>
|
||||
<option value="6">Gargantuan</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
<li class="flexrow item">
|
||||
<label class="generic-label">Sex</label>
|
||||
<input type="text" class="" name="system.biodata.sex" value="{{data.biodata.sex}}" data-dtype="String" />
|
||||
</li>
|
||||
<li class="flexrow item">
|
||||
<label class="generic-label">Preferred Hand</label>
|
||||
<input type="text" class="" name="system.biodata.preferredhand" value="{{data.biodata.preferredhand}}"
|
||||
data-dtype="String" />
|
||||
</li>
|
||||
<li class="flexrow item" data-item-id="{{race._id}}">
|
||||
<label class="generic-label">Race</label>
|
||||
<a class="item-edit"><img class="stat-icon" src="{{race.img}}"></a>
|
||||
<input type="text" class="" name="system.biodata.racename" value="{{data.biodata.racename}}" data-dtype="String" />
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<hr>
|
||||
<h3>Background : </h3>
|
||||
<div class="form-group editor">
|
||||
{{editor data.biodata.description target="system.biodata.description" button=true owner=owner
|
||||
editable=editable}}
|
||||
</div>
|
||||
<hr>
|
||||
<h3>Notes : </h3>
|
||||
<div class="form-group editor">
|
||||
{{editor data.biodata.notes target="system.biodata.notes" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
<hr>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</form>
|
6
templates/actors/editor-notes-gm.hbs
Normal file
@ -0,0 +1,6 @@
|
||||
{{#if data.isGM}}
|
||||
<h3>GM Notes : </h3>
|
||||
<div class="form-group editor">
|
||||
{{editor data.gmnotes target="system.gmnotes" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
{{/if}}
|
53
templates/chat/chat-generic-result.hbs
Normal file
@ -0,0 +1,53 @@
|
||||
<div class="chat-message-header">
|
||||
{{#if actorImg}}
|
||||
<img class="actor-icon" src="{{actorImg}}" alt="{{alias}}" />
|
||||
{{/if}}
|
||||
<h4 class=chat-actor-name>{{alias}}</h4>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{{#if img}}
|
||||
<div >
|
||||
<img class="chat-icon" src="{{img}}" alt="{{name}}" />
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="flexcol">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<ul>
|
||||
{{#if skill}}
|
||||
<li>Skill : {{skill.name}} ({{skill.finalvalue}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if crafting}}
|
||||
<li>Crafting : {{crafting.name}} ({{crafting.system.level}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if spell}}
|
||||
<li>Spell : {{spell.name}} ({{spell.system.level}})
|
||||
</li>
|
||||
<li>Focus Points Spent : {{spellCost}}
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
<li>Bonus/Malus {{bonusMalusRoll}} </li>
|
||||
<li>Dice Formula {{diceFormula}} </li>
|
||||
<li>Result {{roll.total}} </li>
|
||||
|
||||
{{#if (ne targetCheck "none")}}
|
||||
{{#if isSuccess}}
|
||||
<li><strong>Success !</strong></li>
|
||||
{{else}}
|
||||
<li><strong>Failure !</strong></li>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
88
templates/dialogs/roll-dialog-generic.hbs
Normal file
@ -0,0 +1,88 @@
|
||||
<form class="skill-roll-dialog">
|
||||
<header class="roll-dialog-header">
|
||||
{{#if img}}
|
||||
<img class="actor-icon" src="{{img}}" data-edit="img" title="{{name}}" />
|
||||
{{/if}}
|
||||
<h1 class="dialog-roll-title roll-dialog-header">{{title}}</h1>
|
||||
</header>
|
||||
|
||||
<div class="flexcol">
|
||||
|
||||
{{#if skill}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Skill : </span>
|
||||
<span class="roll-dialog-label">{{skill.name}} ({{skill.finalvalue}})</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if crafting}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Crafting : </span>
|
||||
<span class="roll-dialog-label">{{crafting.name}} ({{crafting.system.level}})</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if weapon}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Weapon Attack Bonus : </span>
|
||||
<span class="roll-dialog-label">{{weapon.attackBonus}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if spell}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Spell : </span>
|
||||
<span class="roll-dialog-label">{{spell.name}} ({{upperFirst spell.system.level}} - Cost : {{spellCost}})</span>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Spell Attack level : </span>
|
||||
<span class="roll-dialog-label">{{spellAttack}}</span>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Spell Damage level : </span>
|
||||
<span class="roll-dialog-label">{{spellDamage}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Bonus/Malus : </span>
|
||||
<select id="bonusMalusRoll" name="bonusMalusRoll">
|
||||
{{#select bonusMalusRoll}}
|
||||
<option value="-4">-4</option>
|
||||
<option value="-3">-3</option>
|
||||
<option value="-2">-2</option>
|
||||
<option value="-1">-1</option>
|
||||
<option value="0">0</option>
|
||||
<option value="1">+1</option>
|
||||
<option value="2">+2</option>
|
||||
<option value="3">+3</option>
|
||||
<option value="4">+4</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{#if (eq skillKey "initiative") }}
|
||||
|
||||
{{else}}
|
||||
{{#if (or spell weapon)}}
|
||||
|
||||
{{else}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Target check : </span>
|
||||
<select id="targetCheck" name="targetCheck">
|
||||
{{#select targetCheck}}
|
||||
<option value="none">None</option>
|
||||
<option value="5">5 (Trivial)</option>
|
||||
<option value="7">7 (Easy)</option>
|
||||
<option value="10">10 (Regular)</option>
|
||||
<option value="14">14 (Difficult)</option>
|
||||
<option value="20">20 (Heroic)</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
64
templates/items/item-weapon-sheet.hbs
Normal file
@ -0,0 +1,64 @@
|
||||
<form class="{{cssClass}}" autocomplete="off">
|
||||
<header class="sheet-header">
|
||||
<img class="item-sheet-img" src="{{img}}" data-edit="img" title="{{name}}"/>
|
||||
<div class="header-fields">
|
||||
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{{> systems/fvtt-avd12/templates/items/partial-item-nav.hbs}}
|
||||
|
||||
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
|
||||
{{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}}
|
||||
|
||||
<div class="tab details" data-group="primary" data-tab="details">
|
||||
|
||||
<div class="tab" data-group="primary">
|
||||
<ul>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Type d'arme</label>
|
||||
<select class="item-field-label-long" type="text" name="system.armetype" value="{{system.armetype}}" data-dtype="String">
|
||||
{{#select system.category}}
|
||||
{{#each config.armeTypes as |type key| }}
|
||||
<option value="{{key}}">type</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Dommages normaux</label>
|
||||
<input type="text" class="item-field-label-short" name="system.dommagenormale" value="{{system.dommagenormale}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Dommages particuliers</label>
|
||||
<input type="text" class="item-field-label-short" name="system.dommagepart" value="{{system.dommagepart}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Critiques Mortels ?</label>
|
||||
<input type="checkbox" class="item-field-label-short" name="system.dommagecritiquemort" {{checked system.dommagecritiquemort}} />
|
||||
|
||||
<label class="item-field-label-short"> </label>
|
||||
|
||||
<label class="item-field-label-long">Critiques KO ?</label>
|
||||
<input type="checkbox" class="item-field-label-short" name="system.dommagecritiqueKO" {{checked system.dommagecritiqueKO}} />
|
||||
</li>
|
||||
|
||||
<li class="flexrow">
|
||||
<label class="item-field-label-long">Dommages critiques</label>
|
||||
<input type="text" class="item-field-label-short" name="system.dommagecritique" value="{{system.dommagecritique}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</form>
|
8
templates/items/partial-item-description.hbs
Normal file
@ -0,0 +1,8 @@
|
||||
<div class="tab description" data-group="primary" data-tab="description">
|
||||
<div>
|
||||
<label class="generic-label">Description</label>
|
||||
<div class="medium-editor item-text-long-line">
|
||||
{{editor description target="system.description" button=true owner=owner editable=editable}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
8
templates/items/partial-item-nav.hbs
Normal file
@ -0,0 +1,8 @@
|
||||
{{!-- Sheet Tab Navigation --}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
<a class="item" data-tab="description">Description</a>
|
||||
<a class="item" data-tab="details">Details</a>
|
||||
{{#if builder}}
|
||||
<a class="item" data-tab="builder">Builder (GM only)</a>
|
||||
{{/if}}
|
||||
</nav>
|