Initial import
5
docs/.directory
Normal file
@ -0,0 +1,5 @@
|
||||
[Dolphin]
|
||||
Timestamp=2022,10,17,14,7,24.938
|
||||
Version=4
|
||||
ViewMode=1
|
||||
VisibleRoles=Details_text,Details_size,Details_modificationtime,Details_creationtime,CustomizedDetails
|
BIN
docs/AVD12PlayGuide_ALPHA_6_10_2022.pdf
Normal file
BIN
docs/THEME.png
Normal file
After Width: | Height: | Size: 12 KiB |
14
docs/THEME.scss
Normal file
@ -0,0 +1,14 @@
|
||||
$black: #252525;
|
||||
$absolute_black: black;
|
||||
$white: white;
|
||||
$diluted_black: rgba(0, 0, 0, 0.5);
|
||||
|
||||
$stormy: #494e6b;
|
||||
$cloud: #98878f;
|
||||
$sunset: #985e6d;
|
||||
$evening: #192231;
|
||||
|
||||
$satpurple: rgb(85, 65, 130);
|
||||
$satpurple_faded: rgb(85, 65, 130, 0.5);
|
||||
$satpurple_faded_darker: rgba(57, 43, 92, 0.5);
|
||||
$satpurple_faded_lighter: rgba(130, 107, 185, 0.5);
|
BIN
docs/UI_EXAMPLE.png
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
images/icons/boots1.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
images/icons/boots2.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
images/icons/chest1.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
images/icons/chest2.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
images/icons/cloak1.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
images/icons/cloak2.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
images/icons/focus1.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
images/icons/focus2.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
images/icons/gloves1.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
images/icons/gloves2.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
images/icons/helmet1.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
images/icons/helmet2.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
images/icons/legs1.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
images/icons/legs2.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
images/icons/ring1.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
images/icons/ring2.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
images/icons/shield1.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
images/icons/shield2.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
images/icons/weapon1.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
images/icons/weapon2.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
images/ui/D12_Black.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
images/ui/D12_White.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
images/ui/logo.png
Normal file
After Width: | Height: | Size: 268 KiB |
214
modules/avd12-actor-sheet.js
Normal file
@ -0,0 +1,214 @@
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class Avd12ActorSheet extends ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-avd12", "sheet", "actor"],
|
||||
template: "systems/fvtt-avd12/templates/actor-sheet.html",
|
||||
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,
|
||||
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()),
|
||||
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")
|
||||
CrucibleUtility.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;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onDropItem(event, dragData) {
|
||||
console.log(">>>>>> DROPPED!!!!")
|
||||
const item = fromUuidSync(dragData.uuid)
|
||||
if (item == undefined) {
|
||||
item = this.actor.items.get( item.id )
|
||||
}
|
||||
let ret = await this.actor.preprocessItem( event, item, true )
|
||||
if ( ret ) {
|
||||
super._onDropItem(event, dragData)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
_updateObject(event, formData) {
|
||||
// Update the Actor
|
||||
return this.object.update(formData);
|
||||
}
|
||||
}
|
728
modules/avd12-actor.js
Normal file
@ -0,0 +1,728 @@
|
||||
/* -------------------------------------------- */
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
import { Avd12RollDialog } from "./avd12-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 Avd12Actor 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') {
|
||||
const skills = await Avd12Utility.loadCompendium("fvtt-avd12.skills")
|
||||
data.items = skills.map(i => i.toObject())
|
||||
}
|
||||
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) {
|
||||
this.system.encCapacity = this.getEncumbranceCapacity()
|
||||
this.buildContainerTree()
|
||||
this.computeHitPoints()
|
||||
this.computeEffortPoints()
|
||||
}
|
||||
|
||||
super.prepareDerivedData();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_preUpdate(changed, options, user) {
|
||||
|
||||
super._preUpdate(changed, options, user);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getEncumbranceCapacity() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getMoneys() {
|
||||
let comp = this.items.filter(item => item.type == 'money');
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getEquippedWeapons() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'weapon' && item.system.equipped) || []);
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getArmors() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'armor') || []);
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getEquippedArmor() {
|
||||
let comp = this.items.find(item => item.type == 'armor' && item.system.equipped)
|
||||
if (comp) {
|
||||
return duplicate(comp)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getShields() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'shield') || []);
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getEquippedShield() {
|
||||
let comp = this.items.find(item => item.type == 'shield' && item.system.equipped)
|
||||
if (comp) {
|
||||
return duplicate(comp)
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
checkAndPrepareEquipment(item) {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
checkAndPrepareEquipments(listItem) {
|
||||
for (let item of listItem) {
|
||||
this.checkAndPrepareEquipment(item)
|
||||
}
|
||||
return listItem
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getConditions() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'condition') || []);
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getWeapons() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'weapon') || []);
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getItemById(id) {
|
||||
let item = this.items.find(item => item.id == id);
|
||||
if (item) {
|
||||
item = duplicate(item)
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getSkills() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'skill') || [])
|
||||
for (let skill of comp) {
|
||||
Avd12Utility.updateSkill(skill)
|
||||
}
|
||||
Avd12Utility.sortArrayObjectsByName(comp)
|
||||
return comp
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getRelevantAttribute(attrKey) {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'skill' && item.system.attribute == attrKey) || []);
|
||||
return comp;
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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;
|
||||
}
|
||||
|
||||
/* ------------------------------------------- */
|
||||
getEquipments() {
|
||||
return this.items.filter(item => item.type == 'shield' || item.type == 'armor' || item.type == "weapon" || item.type == "equipment");
|
||||
}
|
||||
/* ------------------------------------------- */
|
||||
getEquipmentsOnly() {
|
||||
return duplicate(this.items.filter(item => item.type == "equipment") || [])
|
||||
}
|
||||
|
||||
/* ------------------------------------------- */
|
||||
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 = Avd12Utility.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 rollArmor(rollData) {
|
||||
let armor = this.getEquippedArmor()
|
||||
if (armor) {
|
||||
|
||||
}
|
||||
return { armor: "none" }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incDecHP(formula) {
|
||||
let dmgRoll = new Roll(formula).roll({ async: false })
|
||||
await Avd12Utility.showDiceSoNice(dmgRoll, game.settings.get("core", "rollMode"))
|
||||
let hp = duplicate(this.system.secondary.hp)
|
||||
hp.value = Number(hp.value) + Number(dmgRoll.total)
|
||||
this.update({ 'system.secondary.hp': hp })
|
||||
return Number(dmgRoll.total)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addObjectToContainer(itemId, containerId) {
|
||||
let container = this.items.find(item => item.id == containerId && item.system.iscontainer)
|
||||
let object = this.items.find(item => item.id == itemId)
|
||||
if (container) {
|
||||
if (object.system.iscontainer) {
|
||||
ui.notifications.warn("Only 1 level of container allowed")
|
||||
return
|
||||
}
|
||||
let alreadyInside = this.items.filter(item => item.system.containerid && item.system.containerid == containerId);
|
||||
if (alreadyInside.length >= container.system.containercapacity) {
|
||||
ui.notifications.warn("Container is already full !")
|
||||
return
|
||||
} else {
|
||||
await this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'system.containerid': containerId }])
|
||||
}
|
||||
} else if (object && object.system.containerid) { // remove from container
|
||||
console.log("Removeing: ", object)
|
||||
await this.updateEmbeddedDocuments("Item", [{ _id: object.id, 'system.containerid': "" }]);
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async preprocessItem(event, item, onDrop = false) {
|
||||
let dropID = $(event.target).parents(".item").attr("data-item-id") // Only relevant if container drop
|
||||
let objectID = item.id || item._id
|
||||
this.addObjectToContainer(objectID, dropID)
|
||||
return true
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getInitiativeScore(combatId, combatantId) {
|
||||
if (this.type == 'character') {
|
||||
this.rollMR(true, combatId, combatantId)
|
||||
}
|
||||
console.log("Init required !!!!")
|
||||
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 });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
syncRoll(rollData) {
|
||||
this.lastRollId = rollData.rollId;
|
||||
Avd12Utility.saveRollData(rollData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getOneSkill(skillId) {
|
||||
let skill = this.items.find(item => item.type == 'skill' && item.id == skillId)
|
||||
if (skill) {
|
||||
skill = duplicate(skill);
|
||||
}
|
||||
return skill;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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 incrementSkillExp(skillId, inc) {
|
||||
let skill = this.items.get(skillId)
|
||||
if (skill) {
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: skill.id, 'system.exp': skill.system.exp + inc }])
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: `<div>${this.name} has gained 1 exp in the skill ${skill.name} (exp = ${skill.system.exp})</div`
|
||||
}
|
||||
ChatMessage.create(chatData)
|
||||
if (skill.system.exp >= 25) {
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: skill.id, 'system.exp': 0, 'system.explevel': skill.system.explevel + 1 }])
|
||||
let chatData = {
|
||||
user: game.user.id,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
|
||||
content: `<div>${this.name} has gained 1 exp SL in the skill ${skill.name} (new exp SL : ${skill.system.explevel}) !</div`
|
||||
}
|
||||
ChatMessage.create(chatData)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
isForcedAdvantage() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.advantage)
|
||||
}
|
||||
isForcedDisadvantage() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.disadvantage)
|
||||
}
|
||||
isForcedRollAdvantage() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.rolladvantage)
|
||||
}
|
||||
isForcedRollDisadvantage() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.rolldisadvantage)
|
||||
}
|
||||
isNoAdvantage() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.noadvantage)
|
||||
}
|
||||
isNoAction() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.noaction)
|
||||
}
|
||||
isAttackDisadvantage() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.attackdisadvantage)
|
||||
}
|
||||
isDefenseDisadvantage() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.defensedisadvantage)
|
||||
}
|
||||
isAttackerAdvantage() {
|
||||
return this.items.find(cond => cond.type == "condition" && cond.system.targetadvantage)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCommonRollData(abilityKey = undefined) {
|
||||
let noAction = this.isNoAction()
|
||||
if (noAction) {
|
||||
ui.notifications.warn("You can't do any actions du to the condition : " + noAction.name)
|
||||
return
|
||||
}
|
||||
|
||||
let rollData = Avd12Utility.getBasicRollData()
|
||||
rollData.alias = this.name
|
||||
rollData.actorImg = this.img
|
||||
rollData.actorId = this.id
|
||||
rollData.img = this.img
|
||||
rollData.featsDie = this.getFeatsWithDie()
|
||||
rollData.featsSL = this.getFeatsWithSL()
|
||||
rollData.armors = this.getArmors()
|
||||
rollData.conditions = this.getConditions()
|
||||
rollData.featDieName = "none"
|
||||
rollData.featSLName = "none"
|
||||
rollData.rollAdvantage = "none"
|
||||
rollData.advantage = "none"
|
||||
rollData.disadvantage = "none"
|
||||
rollData.forceAdvantage = this.isForcedAdvantage()
|
||||
rollData.forceDisadvantage = this.isForcedDisadvantage()
|
||||
rollData.forceRollAdvantage = this.isForcedRollAdvantage()
|
||||
rollData.forceRollDisadvantage = this.isForcedRollDisadvantage()
|
||||
rollData.noAdvantage = this.isNoAdvantage()
|
||||
if (rollData.defenderTokenId) {
|
||||
let defenderToken = game.canvas.tokens.get(rollData.defenderTokenId)
|
||||
let defender = defenderToken.actor
|
||||
|
||||
// Distance management
|
||||
let token = this.token
|
||||
if (!token) {
|
||||
let tokens = this.getActiveTokens()
|
||||
token = tokens[0]
|
||||
}
|
||||
if (token) {
|
||||
const ray = new Ray(token.object?.center || token.center, defenderToken.center)
|
||||
rollData.tokensDistance = canvas.grid.measureDistances([{ ray }], { gridSpaces: false })[0] / canvas.grid.grid.options.dimensions.distance
|
||||
} else {
|
||||
ui.notifications.info("No token connected to this actor, unable to compute distance.")
|
||||
return
|
||||
}
|
||||
if (defender) {
|
||||
rollData.forceAdvantage = defender.isAttackerAdvantage()
|
||||
rollData.advantageFromTarget = true
|
||||
}
|
||||
}
|
||||
|
||||
if (abilityKey) {
|
||||
rollData.ability = this.getAbility(abilityKey)
|
||||
rollData.selectedKill = undefined
|
||||
}
|
||||
|
||||
console.log("ROLLDATA", rollData)
|
||||
|
||||
return rollData
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollAbility(abilityKey) {
|
||||
let rollData = this.getCommonRollData(abilityKey)
|
||||
rollData.mode = "ability"
|
||||
if (rollData.target) {
|
||||
ui.notifications.warn("You are targetting a token with a skill : please use a Weapon instead.")
|
||||
return
|
||||
}
|
||||
Avd12Utility.rollCrucible(rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollSkill(skillId) {
|
||||
let skill = this.items.get(skillId)
|
||||
if (skill) {
|
||||
if (skill.system.islore && skill.system.level == 0) {
|
||||
ui.notifications.warn("You can't use Lore Skills with a SL of 0.")
|
||||
return
|
||||
}
|
||||
skill = duplicate(skill)
|
||||
Avd12Utility.updateSkill(skill)
|
||||
let abilityKey = skill.system.ability
|
||||
let rollData = this.getCommonRollData(abilityKey)
|
||||
rollData.mode = "skill"
|
||||
rollData.skill = skill
|
||||
rollData.img = skill.img
|
||||
if (rollData.target) {
|
||||
ui.notifications.warn("You are targetting a token with a skill : please use a Weapon instead.")
|
||||
return
|
||||
}
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollWeapon(weaponId) {
|
||||
let weapon = this.items.get(weaponId)
|
||||
if (weapon) {
|
||||
weapon = duplicate(weapon)
|
||||
let skill = this.items.find(item => item.name.toLowerCase() == weapon.system.skill.toLowerCase())
|
||||
if (skill) {
|
||||
skill = duplicate(skill)
|
||||
Avd12Utility.updateSkill(skill)
|
||||
let abilityKey = skill.system.ability
|
||||
let rollData = this.getCommonRollData(abilityKey)
|
||||
rollData.mode = "weapon"
|
||||
rollData.skill = skill
|
||||
rollData.weapon = weapon
|
||||
rollData.img = weapon.img
|
||||
if (!rollData.forceDisadvantage) { // This is an attack, check if disadvantaged
|
||||
rollData.forceDisadvantage = this.isAttackDisadvantage()
|
||||
}
|
||||
/*if (rollData.weapon.system.isranged && rollData.tokensDistance > Avd12Utility.getWeaponMaxRange(rollData.weapon) ) {
|
||||
ui.notifications.warn(`Your target is out of range of your weapon (max: ${Avd12Utility.getWeaponMaxRange(rollData.weapon)} - current : ${rollData.tokensDistance})` )
|
||||
return
|
||||
}*/
|
||||
this.startRoll(rollData)
|
||||
} else {
|
||||
ui.notifications.warn("Unable to find the relevant skill for weapon " + weapon.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollDefenseMelee(attackRollData) {
|
||||
let weapon = this.items.get(attackRollData.defenseWeaponId)
|
||||
if (weapon) {
|
||||
weapon = duplicate(weapon)
|
||||
let skill = this.items.find(item => item.name.toLowerCase() == weapon.system.skill.toLowerCase())
|
||||
if (skill) {
|
||||
skill = duplicate(skill)
|
||||
Avd12Utility.updateSkill(skill)
|
||||
let abilityKey = skill.system.ability
|
||||
let rollData = this.getCommonRollData(abilityKey)
|
||||
rollData.defenderTokenId = undefined // Cleanup
|
||||
rollData.mode = "weapondefense"
|
||||
rollData.shield = this.getEquippedShield()
|
||||
rollData.attackRollData = duplicate(attackRollData)
|
||||
rollData.skill = skill
|
||||
rollData.weapon = weapon
|
||||
rollData.img = weapon.img
|
||||
if (!rollData.forceDisadvantage) { // This is an attack, check if disadvantaged
|
||||
rollData.forceDisadvantage = this.isDefenseDisadvantage()
|
||||
}
|
||||
|
||||
this.startRoll(rollData)
|
||||
} else {
|
||||
ui.notifications.warn("Unable to find the relevant skill for weapon " + weapon.name)
|
||||
}
|
||||
} else {
|
||||
ui.notifications.warn("Weapon not found ! ")
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollDefenseRanged(attackRollData) {
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.defenderTokenId = undefined // Cleanup
|
||||
rollData.mode = "rangeddefense"
|
||||
if ( attackRollData) {
|
||||
rollData.attackRollData = duplicate(attackRollData)
|
||||
rollData.effectiveRange = Avd12Utility.getWeaponRange(attackRollData.weapon)
|
||||
rollData.tokensDistance = attackRollData.tokensDistance // QoL copy
|
||||
}
|
||||
rollData.sizeDice = Avd12Utility.getSizeDice(this.system.biodata.size)
|
||||
rollData.distanceBonusDice = 0 //Math.max(0, Math.floor((rollData.tokensDistance - rollData.effectiveRange) + 0.5))
|
||||
rollData.hasCover = "none"
|
||||
rollData.situational = "none"
|
||||
rollData.useshield = false
|
||||
rollData.shield = this.getEquippedShield()
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollShieldDie() {
|
||||
let shield = this.getEquippedShield()
|
||||
if (shield) {
|
||||
shield = duplicate(shield)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "shield"
|
||||
rollData.shield = shield
|
||||
rollData.useshield = true
|
||||
rollData.img = shield.img
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollArmorDie(rollData = undefined) {
|
||||
let armor = this.getEquippedArmor()
|
||||
if (armor) {
|
||||
armor = duplicate(armor)
|
||||
let reduce = 0
|
||||
let multiply = 1
|
||||
let disadvantage = false
|
||||
let advantage = false
|
||||
let messages = ["Armor applied"]
|
||||
|
||||
if (rollData) {
|
||||
if (Avd12Utility.isArmorLight(armor) && Avd12Utility.isWeaponPenetrating(rollData.attackRollData.weapon)) {
|
||||
return { armorIgnored: true, nbSuccess: 0, messages: ["Armor ignored : Penetrating weapons ignore Light Armors."] }
|
||||
}
|
||||
if (Avd12Utility.isWeaponPenetrating(rollData.attackRollData.weapon)) {
|
||||
messages.push("Armor reduced by 1 (Penetrating weapon)")
|
||||
reduce = 1
|
||||
}
|
||||
if (Avd12Utility.isWeaponLight(rollData.attackRollData.weapon)) {
|
||||
messages.push("Armor with advantage (Light weapon)")
|
||||
advantage = true
|
||||
}
|
||||
if (Avd12Utility.isWeaponHeavy(rollData.attackRollData.weapon)) {
|
||||
messages.push("Armor with disadvantage (Heavy weapon)")
|
||||
disadvantage = true
|
||||
}
|
||||
if (Avd12Utility.isWeaponHack(rollData.attackRollData.weapon)) {
|
||||
messages.push("Armor reduced by 1 (Hack weapon)")
|
||||
reduce = 1
|
||||
}
|
||||
if (Avd12Utility.isWeaponUndamaging(rollData.attackRollData.weapon)) {
|
||||
messages.push("Armor multiplied by 2 (Undamaging weapon)")
|
||||
multiply = 2
|
||||
}
|
||||
}
|
||||
let diceColor = armor.system.absorprionroll
|
||||
let armorResult = await Avd12Utility.getRollTableFromDiceColor(diceColor, false)
|
||||
console.log("Armor log", armorResult)
|
||||
let armorValue = Math.max(0, (Number(armorResult.text) + reduce) * multiply)
|
||||
if (advantage || disadvantage) {
|
||||
let armorResult2 = await Avd12Utility.getRollTableFromDiceColor(diceColor, false)
|
||||
let armorValue2 = Math.max(0, (Number(armorResult2.text) + reduce) * multiply)
|
||||
if (advantage) {
|
||||
armorValue = (armorValue2 > armorValue) ? armorValue2 : armorValue
|
||||
messages.push(`Armor advantage - Roll 1 = ${armorValue} - Roll 2 = ${armorValue2}`)
|
||||
}
|
||||
if (disadvantage) {
|
||||
armorValue = (armorValue2 < armorValue) ? armorValue2 : armorValue
|
||||
messages.push(`Armor disadvantage - Roll 1 = ${armorValue} - Roll 2 = ${armorValue2}`)
|
||||
}
|
||||
}
|
||||
armorResult.armorValue = armorValue
|
||||
if (!rollData) {
|
||||
ChatMessage.create({ content: "Armor result : " + armorValue })
|
||||
}
|
||||
messages.push("Armor result : " + armorValue)
|
||||
return { armorIgnored: false, nbSuccess: armorValue, rawArmor: armorResult.text, messages: messages }
|
||||
}
|
||||
return { armorIgnored: true, nbSuccess: 0, messages: ["No armor equipped."] }
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollSave(saveKey) {
|
||||
let saves = this.getSaveRoll()
|
||||
let save = saves[saveKey]
|
||||
if (save) {
|
||||
save = duplicate(save)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "save"
|
||||
rollData.save = save
|
||||
if (rollData.target) {
|
||||
ui.notifications.warn("You are targetting a token with a save roll - Not authorized.")
|
||||
return
|
||||
}
|
||||
this.startRoll(rollData)
|
||||
}
|
||||
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async startRoll(rollData) {
|
||||
this.syncRoll(rollData)
|
||||
let rollDialog = await CrucibleRollDialog.create(this, rollData)
|
||||
rollDialog.render(true)
|
||||
}
|
||||
|
||||
}
|
30
modules/avd12-combat.js
Normal file
@ -0,0 +1,30 @@
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class Avd12Combat 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()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
117
modules/avd12-commands.js
Normal file
@ -0,0 +1,117 @@
|
||||
/* -------------------------------------------- */
|
||||
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
import { Avd12RollDialog } from "./avd12-roll-dialog.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class Avd12Commands {
|
||||
|
||||
static init() {
|
||||
if (!game.system.avd12.commands) {
|
||||
const crucibleCommands = new CrucibleCommands();
|
||||
//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.avd12.commands = crucibleCommands;
|
||||
}
|
||||
}
|
||||
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 = Avd12Utility.getBasicRollData()
|
||||
rollData.alias = "Dice Pool Roll",
|
||||
rollData.mode = "generic"
|
||||
rollData.title = `Dice Pool Roll`;
|
||||
|
||||
let rollDialog = await Avd12RollDialog.create( this, rollData);
|
||||
rollDialog.render( true );
|
||||
}
|
||||
|
||||
}
|
86
modules/avd12-hotbar.js
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
export class Avd12Hotbar {
|
||||
|
||||
/**
|
||||
* 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.avd12.Avd12Hotbar.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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
163
modules/avd12-item-sheet.js
Normal file
@ -0,0 +1,163 @@
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class Avd12ItemSheet extends ItemSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-avd12", "sheet", "item"],
|
||||
template: "systems/fvtt-avd12/templates/item-sheet.html",
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
||||
width: 620,
|
||||
height: 550,
|
||||
tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_getHeaderButtons() {
|
||||
let buttons = super._getHeaderButtons();
|
||||
// Add "Post to chat" button
|
||||
// We previously restricted this to GM and editable items only. If you ever find this comment because it broke something: eh, sorry!
|
||||
buttons.unshift(
|
||||
{
|
||||
class: "post",
|
||||
icon: "fas fa-comment",
|
||||
onclick: ev => { }
|
||||
})
|
||||
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",
|
||||
weaponSkills: CrucibleUtility.getWeaponSkills(),
|
||||
shieldSkills: CrucibleUtility.getShieldSkills(),
|
||||
system: duplicate(this.object.system),
|
||||
limited: this.object.limited,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
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(CrucibleUtility.data(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/avd12/templates/post-item.html', chatData).then(html => {
|
||||
let chatOptions = CrucibleUtility.chatDataSetup(html);
|
||||
ChatMessage.create(chatOptions)
|
||||
});
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @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-spec').click(ev => {
|
||||
this.object.update({ "data.specialisation": [{ name: 'None' }] });
|
||||
});
|
||||
|
||||
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");
|
||||
});
|
||||
|
||||
html.find('.view-subitem').click(ev => {
|
||||
this.viewSubitem(ev);
|
||||
});
|
||||
|
||||
html.find('.view-spec').click(ev => {
|
||||
this.manageSpec();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
get template() {
|
||||
let type = this.item.type;
|
||||
return `systems/avd12/templates/items/item-${type}-sheet.html`
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/** @override */
|
||||
_updateObject(event, formData) {
|
||||
return this.object.update(formData)
|
||||
}
|
||||
}
|
24
modules/avd12-item.js
Normal file
@ -0,0 +1,24 @@
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
|
||||
export const defaultItemImg = {
|
||||
skill: "systems/fvtt-crucible-rpg/images/icons/icon_skill.webp",
|
||||
armor: "systems/fvtt-crucible-rpg/images/icons/icon_armour.webp",
|
||||
weapon: "systems/fvtt-crucible-rpg/images/icons/icon_weapon.webp",
|
||||
equipment: "systems/fvtt-crucible-rpg/images/icons/icon_equipment.webp",
|
||||
money: "systems/fvtt-crucible-rpg/images/icons/icon_money.webp",
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet with some very simple modifications
|
||||
* @extends {ItemSheet}
|
||||
*/
|
||||
export class CrucibleItem extends Item {
|
||||
|
||||
constructor(data, context) {
|
||||
if (!data.img) {
|
||||
data.img = defaultItemImg[data.type];
|
||||
}
|
||||
super(data, context);
|
||||
}
|
||||
|
||||
}
|
115
modules/avd12-main.js
Normal file
@ -0,0 +1,115 @@
|
||||
/**
|
||||
* AVD12 system
|
||||
* Author: Uberwald
|
||||
* Software License: Prop
|
||||
*/
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Import Modules
|
||||
import { Avd12Actor } from "./avd12-actor.js";
|
||||
import { Avd12ItemSheet } from "./avd12-item-sheet.js";
|
||||
import { Avd12ActorSheet } from "./avd12-actor-sheet.js";
|
||||
import { Avd12NPCSheet } from "./avd12-npc-sheet.js";
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
import { Avd12Combat } from "./avd12-combat.js";
|
||||
import { Avd12Item } from "./avd12-item.js";
|
||||
import { Avd12Hotbar } from "./avd12-hotbar.js"
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/************************************************************************************/
|
||||
Hooks.once("init", async function () {
|
||||
|
||||
console.log(`Initializing AVD12 RPG`);
|
||||
|
||||
game.system.avd12 = {
|
||||
Avd12Hotbar
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// preload handlebars templates
|
||||
Avd12Utility.preloadHandlebarsTemplates();
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Set an initiative formula for the system
|
||||
CONFIG.Combat.initiative = {
|
||||
formula: "1d6",
|
||||
decimals: 1
|
||||
};
|
||||
|
||||
/* -------------------------------------------- */
|
||||
game.socket.on("system.fvtt-avd12", data => {
|
||||
Avd12Utility.onSocketMesssage(data)
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Define custom Entity classes
|
||||
CONFIG.Combat.documentClass = Avd12Combat
|
||||
CONFIG.Actor.documentClass = Avd12Actor
|
||||
CONFIG.Item.documentClass = Avd12Item
|
||||
|
||||
/* -------------------------------------------- */
|
||||
// Register sheet application classes
|
||||
Actors.unregisterSheet("core", ActorSheet);
|
||||
Actors.registerSheet("fvtt-avd12", Avd12ActorSheet, { types: ["character"], makeDefault: true });
|
||||
Actors.registerSheet("fvtt-avd12", Avd12NPCSheet, { types: ["npc"], makeDefault: false });
|
||||
|
||||
Items.unregisterSheet("core", ItemSheet);
|
||||
Items.registerSheet("fvtt-avd12", Avd12ItemSheet, { makeDefault: true });
|
||||
|
||||
Avd12Utility.init()
|
||||
});
|
||||
|
||||
/* -------------------------------------------- */
|
||||
function welcomeMessage() {
|
||||
ChatMessage.create({
|
||||
user: game.user.id,
|
||||
whisper: [game.user.id],
|
||||
content: `<div id="welcome-message-avd12"><span class="rdd-roll-part">
|
||||
<strong>Welcome to the AVD12 RPG.</strong>
|
||||
` });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* Foundry VTT Initialization */
|
||||
/* -------------------------------------------- */
|
||||
Hooks.once("ready", function () {
|
||||
|
||||
// User warning
|
||||
if (!game.user.isGM && game.user.character == undefined) {
|
||||
ui.notifications.info("Warning ! No character linked to your user !");
|
||||
ChatMessage.create({
|
||||
content: "<b>WARNING</b> The player " + game.user.name + " is not linked to a character !",
|
||||
user: game.user._id
|
||||
});
|
||||
}
|
||||
|
||||
// CSS patch for v9
|
||||
if (game.version) {
|
||||
let sidebar = document.getElementById("sidebar");
|
||||
sidebar.style.width = "min-content";
|
||||
}
|
||||
|
||||
welcomeMessage();
|
||||
Avd12Utility.ready()
|
||||
Avd12Utility.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.avd12.commands.processChatCommand(commands, content, msg)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
207
modules/avd12-npc-sheet.js
Normal file
@ -0,0 +1,207 @@
|
||||
/**
|
||||
* Extend the basic ActorSheet with some very simple modifications
|
||||
* @extends {ActorSheet}
|
||||
*/
|
||||
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class CrucibleNPCSheet extends ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["avd12", "sheet", "actor"],
|
||||
template: "systems/fvtt-avd12/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")
|
||||
CrucibleUtility.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);
|
||||
}
|
||||
}
|
84
modules/avd12-roll-dialog.js
Normal file
@ -0,0 +1,84 @@
|
||||
import { Avd12Utility } from "./avd12-utility.js";
|
||||
|
||||
export class Avd12RollDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async create(actor, rollData) {
|
||||
|
||||
let options = { classes: ["Avd12Dialog"], width: 540, height: 340, 'z-index': 99999 };
|
||||
let html = await renderTemplate('systems/fvtt-avd12/templates/dialogs/roll-dialog-generic.html', rollData);
|
||||
|
||||
return new CrucibleRollDialog(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() {
|
||||
Avd12Utility.rollAvd12(this.rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async refreshDialog() {
|
||||
const content = await renderTemplate("systems/fvtt-avd12/templates/dialogs/roll-dialog-generic.html", this.rollData)
|
||||
this.data.content = content
|
||||
this.render(true)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
|
||||
var dialog = this;
|
||||
function onLoad() {
|
||||
}
|
||||
$(function () { onLoad(); });
|
||||
|
||||
html.find('#advantage').change((event) => {
|
||||
this.rollData.advantage = event.currentTarget.value
|
||||
})
|
||||
html.find('#disadvantage').change((event) => {
|
||||
this.rollData.disadvantage = event.currentTarget.value
|
||||
})
|
||||
html.find('#rollAdvantage').change((event) => {
|
||||
this.rollData.rollAdvantage = event.currentTarget.value
|
||||
})
|
||||
html.find('#useshield').change((event) => {
|
||||
this.rollData.useshield = event.currentTarget.checked
|
||||
})
|
||||
html.find('#hasCover').change((event) => {
|
||||
this.rollData.hasCover = event.currentTarget.value
|
||||
})
|
||||
html.find('#situational').change((event) => {
|
||||
this.rollData.situational = event.currentTarget.value
|
||||
})
|
||||
html.find('#distanceBonusDice').change((event) => {
|
||||
this.rollData.distanceBonusDice = Number(event.currentTarget.value)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
842
modules/avd12-utility.js
Normal file
@ -0,0 +1,842 @@
|
||||
/* -------------------------------------------- */
|
||||
import { Avd12Combat } from "./avd12-combat.js";
|
||||
import { Avd12Commands } from "./avd12-commands.js";
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class Avd12Utility {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async init() {
|
||||
Hooks.on('renderChatLog', (log, html, data) => Avd12Utility.chatListeners(html));
|
||||
/*Hooks.on("dropCanvasData", (canvas, data) => {
|
||||
Avd12Utility.dropItemOnToken(canvas, data)
|
||||
});*/
|
||||
|
||||
this.rollDataStore = {}
|
||||
this.defenderStore = {}
|
||||
|
||||
CrucibleCommands.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);
|
||||
})
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
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 async ready() {
|
||||
const skills = await Avd12Utility.loadCompendium("fvtt-crucible-rpg.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 Avd12Utility.loadCompendium("fvtt-crucible-rpg.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 Avd12Utility.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 isWeaponPenetrating(weapon) {
|
||||
if (weapon && weapon.system.qualities.toLowerCase().includes("penetrating")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static isWeaponLight(weapon) {
|
||||
if (weapon && weapon.system.qualities.toLowerCase().includes("light")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static isWeaponHeavy(weapon) {
|
||||
if (weapon && weapon.system.qualities.toLowerCase().includes("heavy")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static isWeaponHack(weapon) {
|
||||
if (weapon && weapon.system.qualities.toLowerCase().includes("hack")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static isWeaponUndamaging(weapon) {
|
||||
if (weapon && weapon.system.qualities.toLowerCase().includes("undamaging")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static isWeaponDangerous(weapon) {
|
||||
if (weapon && weapon.system.qualities.toLowerCase().includes("dangerous")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static isWeaponDeadly(weapon) {
|
||||
if (weapon && weapon.system.qualities.toLowerCase().includes("deadly")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
static getWeaponRange(weapon) {
|
||||
if (weapon && weapon.system.isranged) {
|
||||
let rangeValue = weapon.system.range.replace(/[^0-9]/g, '')
|
||||
return Number(rangeValue)
|
||||
}
|
||||
return false
|
||||
}
|
||||
static getWeaponMaxRange(weapon) {
|
||||
if (weapon && weapon.system.isranged) {
|
||||
let rangeValue = weapon.system.maxrange.replace(/[^0-9]/g, '')
|
||||
return Number(rangeValue)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getRollTableFromDiceColor(diceColor, displayChat = true) {
|
||||
let rollTableName = __color2RollTable[diceColor]
|
||||
if (rollTableName) {
|
||||
const pack = game.packs.get("fvtt-crucible-rpg.rolltables")
|
||||
const index = await pack.getIndex()
|
||||
const entry = index.find(e => e.name === rollTableName)
|
||||
let table = await pack.getDocument(entry._id)
|
||||
const draw = await table.draw({ displayChat: displayChat, rollMode: "gmroll" })
|
||||
return draw.results.length > 0 ? draw.results[0] : undefined
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getSizeDice(sizeValue) {
|
||||
return __size2Dice[sizeValue]
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async getCritical(level, weapon) {
|
||||
const pack = game.packs.get("fvtt-crucible-rpg.rolltables")
|
||||
|
||||
let tableName = "Crit " + level + " (" + this.upperFirst(weapon.system.damage) + ")"
|
||||
const index = await pack.getIndex()
|
||||
const entry = index.find(e => e.name === tableName)
|
||||
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 chatListeners(html) {
|
||||
|
||||
html.on("click", '.view-item-from-chat', event => {
|
||||
game.system.crucible.creator.openItemView(event)
|
||||
})
|
||||
html.on("click", '.roll-defense-melee', event => {
|
||||
let rollId = $(event.currentTarget).data("roll-id")
|
||||
let rollData = Avd12Utility.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 = Avd12Utility.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-crucible-rpg/templates/editor-notes-gm.html',
|
||||
'systems/fvtt-crucible-rpg/templates/partial-roll-select.html',
|
||||
'systems/fvtt-crucible-rpg/templates/partial-actor-ability-block.html',
|
||||
'systems/fvtt-crucible-rpg/templates/partial-actor-status.html',
|
||||
'systems/fvtt-crucible-rpg/templates/partial-options-abilities.html',
|
||||
'systems/fvtt-crucible-rpg/templates/partial-item-nav.html',
|
||||
'systems/fvtt-crucible-rpg/templates/partial-item-description.html',
|
||||
'systems/fvtt-crucible-rpg/templates/partial-actor-equipment.html'
|
||||
]
|
||||
return loadTemplates(templatePaths);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static removeChatMessageId(messageId) {
|
||||
if (messageId) {
|
||||
game.messages.get(messageId)?.delete();
|
||||
}
|
||||
}
|
||||
|
||||
static findChatMessageId(current) {
|
||||
return Avd12Utility.getChatMessageId(Avd12Utility.findChatMessage(current));
|
||||
}
|
||||
|
||||
static getChatMessageId(node) {
|
||||
return node?.attributes.getNamedItem('data-message-id')?.value;
|
||||
}
|
||||
|
||||
static findChatMessage(current) {
|
||||
return Avd12Utility.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 Avd12Utility.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.crucible-rpg", {
|
||||
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-crucible-rpg/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-crucible-rpg.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 && Avd12Utility.isWeaponDangerous(rollData.attackRollData.weapon))) {
|
||||
result.fumbleDetails = await this.getFumble(rollData.weapon)
|
||||
}
|
||||
if (result.critical_1 || result.critical_2) {
|
||||
let isDeadly = Avd12Utility.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-crucible-rpg/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-crucible-rpg", { 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 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 rollCrucible(rollData) {
|
||||
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
|
||||
// ability/save/size => 0
|
||||
let diceFormula
|
||||
let startFormula = "0d6cs>=5"
|
||||
if (rollData.ability) {
|
||||
startFormula = String(rollData.ability.value) + "d6cs>=5"
|
||||
}
|
||||
if (rollData.save) {
|
||||
startFormula = String(rollData.save.value) + "d6cs>=5"
|
||||
}
|
||||
if (rollData.sizeDice) {
|
||||
let nb = rollData.sizeDice.nb + rollData.distanceBonusDice + this.getDiceFromCover(rollData.hasCover) + this.getDiceFromSituational(rollData.situational)
|
||||
startFormula = String(nb) + String(rollData.sizeDice.dice) + "cs>=5"
|
||||
}
|
||||
diceFormula = startFormula
|
||||
|
||||
// skill => 2
|
||||
// feat => 4
|
||||
// bonus => 6
|
||||
if (rollData.skill) {
|
||||
let level = rollData.skill.system.level
|
||||
if (rollData.skill.system.issl2) {
|
||||
rollData.hasSLBonus = true
|
||||
level += 2
|
||||
if (level > 7) { level = 7 }
|
||||
}
|
||||
rollData.skill.system.skilldice = __skillLevel2Dice[level]
|
||||
diceFormula += "+" + String(rollData.skill.system.skilldice) + "cs>=5"
|
||||
|
||||
if (rollData.skill.system.skilltype == "complex" && rollData.skill.system.level == 0) {
|
||||
rollData.complexSkillDisadvantage = true
|
||||
rollData.rollAdvantage = "roll-disadvantage"
|
||||
}
|
||||
|
||||
if (rollData.skill.system.isfeatdie) {
|
||||
rollData.hasFeatDie = true
|
||||
diceFormula += "+ 1d10cs>=5"
|
||||
} else {
|
||||
diceFormula += `+ 0d10cs>=5`
|
||||
}
|
||||
if (rollData.skill.system.bonusdice != "none") {
|
||||
rollData.hasBonusDice = rollData.skill.system.bonusdice
|
||||
diceFormula += `+ ${rollData.hasBonusDice}cs>=5`
|
||||
} else {
|
||||
diceFormula += `+ 0d6cs>=5`
|
||||
}
|
||||
} else {
|
||||
diceFormula += `+ 0d8cs=>5 + 0d10cs>=5 + 0d6cs>=5`
|
||||
}
|
||||
|
||||
// advantage => 8
|
||||
let advFormula = "+ 0d8cs>=5"
|
||||
if (rollData.advantage == "advantage1" || rollData.forceAdvantage) {
|
||||
advFormula = "+ 1d8cs>=5"
|
||||
}
|
||||
if (rollData.advantage == "advantage2") {
|
||||
advFormula = "+ 2d8cs>=5"
|
||||
}
|
||||
diceFormula += advFormula
|
||||
|
||||
// disadvantage => 10
|
||||
let disFormula = "- 0d8cs>=5"
|
||||
if (rollData.disadvantage == "disadvantage1" || rollData.forceDisadvantage) {
|
||||
disFormula = "- 1d8cs>=5"
|
||||
}
|
||||
if (rollData.disadvantage == "disadvantage2") {
|
||||
disFormula = "- 2d8cs>=5"
|
||||
}
|
||||
diceFormula += disFormula
|
||||
|
||||
// armor => 12
|
||||
let skillArmorPenalty = 0
|
||||
for (let armor of rollData.armors) {
|
||||
if (armor.system.equipped) {
|
||||
skillArmorPenalty += armor.system.skillpenalty
|
||||
}
|
||||
}
|
||||
if (rollData.skill && rollData.skill.system.armorpenalty && skillArmorPenalty > 0) {
|
||||
rollData.skillArmorPenalty = skillArmorPenalty
|
||||
diceFormula += `- ${skillArmorPenalty}d8cs>=5`
|
||||
} else {
|
||||
diceFormula += `- 0d8cs>=5`
|
||||
}
|
||||
|
||||
// shield => 14
|
||||
if (rollData.useshield && rollData.shield) {
|
||||
diceFormula += "+ 1" + String(rollData.shield.system.shielddie) + "cs>=5"
|
||||
} else {
|
||||
diceFormula += " + 0d6cs>=5"
|
||||
}
|
||||
|
||||
// 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.rollOrder = 0
|
||||
rollData.roll = myRoll
|
||||
rollData.nbSuccess = myRoll.total
|
||||
|
||||
if (rollData.rollAdvantage == "none" && rollData.forceRollAdvantage) {
|
||||
rollData.rollAdvantage = "roll-advantage"
|
||||
}
|
||||
if (rollData.rollAdvantage == "none" && rollData.forceRollDisadvantage) {
|
||||
rollData.rollAdvantage = "roll-disadvantage"
|
||||
}
|
||||
if (rollData.rollAdvantage != "none") {
|
||||
|
||||
rollData.rollOrder = 1
|
||||
rollData.rollType = (rollData.rollAdvantage == "roll-advantage") ? "Advantage" : "Disadvantage"
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-generic-result.html`, rollData)
|
||||
})
|
||||
|
||||
rollData.rollOrder = 2
|
||||
let myRoll2 = new Roll(diceFormula).roll({ async: false })
|
||||
await this.showDiceSoNice(myRoll2, game.settings.get("core", "rollMode"))
|
||||
|
||||
rollData.roll = myRoll2 // Tmp switch to display the proper results
|
||||
rollData.nbSuccess = myRoll2.total
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-generic-result.html`, rollData)
|
||||
})
|
||||
rollData.roll = myRoll // Revert the tmp switch
|
||||
rollData.nbSuccess = myRoll.total
|
||||
|
||||
if (rollData.rollAdvantage == "roll-advantage") {
|
||||
if (myRoll2.total > rollData.nbSuccess) {
|
||||
hasChanged = true
|
||||
rollData.roll = myRoll2
|
||||
rollData.nbSuccess = myRoll2.total
|
||||
}
|
||||
} else {
|
||||
if (myRoll2.total < rollData.nbSuccess) {
|
||||
rollData.roll = myRoll2
|
||||
rollData.nbSuccess = myRoll2.total
|
||||
}
|
||||
}
|
||||
rollData.rollOrder = 3
|
||||
}
|
||||
rollData.nbSuccess = Math.max(0, rollData.nbSuccess)
|
||||
|
||||
rollData.isFirstRollAdvantage = false
|
||||
// Manage exp
|
||||
if (rollData.skill && rollData.skill.system.level > 0) {
|
||||
let nbSkillSuccess = rollData.roll.terms[2].total
|
||||
if (nbSkillSuccess == 0 || nbSkillSuccess == rollData.skill.system.level) {
|
||||
actor.incrementSkillExp(rollData.skill.id, 1)
|
||||
}
|
||||
}
|
||||
|
||||
this.saveRollData(rollData)
|
||||
actor.lastRoll = rollData
|
||||
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-generic-result.html`, rollData)
|
||||
})
|
||||
console.log("Rolldata result", rollData)
|
||||
|
||||
// Message response
|
||||
this.displayDefenseMessage(rollData)
|
||||
|
||||
// Manage defense result
|
||||
this.processAttackDefense(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-crucible-rpg", { msg: "msg_gm_chat_message", data: chatGM });
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async searchItem(dataItem) {
|
||||
let item
|
||||
if (dataItem.pack) {
|
||||
item = await fromUuid("Compendium." + dataItem.pack + "." + dataItem.id)
|
||||
} else {
|
||||
item = game.items.get(dataItem.id)
|
||||
}
|
||||
return item
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
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;
|
||||
ChatMessage.create(chatOptions);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getBasicRollData() {
|
||||
let rollData = {
|
||||
rollId: randomID(16),
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
advantage: "none"
|
||||
}
|
||||
Avd12Utility.updateWithTarget(rollData)
|
||||
return rollData
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateWithTarget(rollData) {
|
||||
let target = Avd12Utility.getTarget()
|
||||
if (target) {
|
||||
rollData.defenderTokenId = target.id
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static createChatWithRollMode(name, chatOptions) {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
1497
styles/simple.css
Normal file
43
system.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"description": "Anyventure D12 system for FoundryVTT",
|
||||
"esmodules": [
|
||||
"modules/avd12-main.js"
|
||||
],
|
||||
"gridDistance": 5,
|
||||
"gridUnits": "m",
|
||||
"languages": [
|
||||
{
|
||||
"lang": "en",
|
||||
"name": "English",
|
||||
"path": "lang/en.json",
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Uberwald",
|
||||
"flags": {}
|
||||
}
|
||||
],
|
||||
"license": "LICENSE.txt",
|
||||
"manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-avd12/raw/branch/master/system.json",
|
||||
"compatibility": {
|
||||
"minimum": "10",
|
||||
"verified": "10.288",
|
||||
"maximum": "10"
|
||||
},
|
||||
"id": "fvtt-avd12",
|
||||
"packs": [
|
||||
],
|
||||
"primaryTokenAttribute": "secondary.health",
|
||||
"secondaryTokenAttribute": "secondary.delirium",
|
||||
"socket": true,
|
||||
"styles": [
|
||||
"styles/simple.css"
|
||||
],
|
||||
"title": "AnyVenture D12 RPG",
|
||||
"url": "https://www.uberwald.me/data/files/fvtt-avd12",
|
||||
"version": "10.0.0",
|
||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-avd12/archive/fvtt-avd12-v10.0.0.zip",
|
||||
"background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp"
|
||||
}
|
196
template.json
Normal file
@ -0,0 +1,196 @@
|
||||
{
|
||||
"Actor": {
|
||||
"types": [
|
||||
"character",
|
||||
"npc"
|
||||
],
|
||||
"templates": {
|
||||
"biodata": {
|
||||
"biodata": {
|
||||
"age": 0,
|
||||
"size": "",
|
||||
"weight": "",
|
||||
"hair": "",
|
||||
"sex": "",
|
||||
"eyes": "",
|
||||
"description": "",
|
||||
"gmnotes": ""
|
||||
}
|
||||
},
|
||||
"core": {
|
||||
"subactors": [],
|
||||
"attributes": {
|
||||
"might": {
|
||||
"label": "Might",
|
||||
"abbrev": "might",
|
||||
"value": 0,
|
||||
"bonuseffect": 0,
|
||||
"mod": 0,
|
||||
"col": 1
|
||||
},
|
||||
"agility": {
|
||||
"label": "Agility",
|
||||
"abbrev": "agility",
|
||||
"value": 0,
|
||||
"bonuseffect": 0,
|
||||
"col": 1,
|
||||
"mod": 0
|
||||
},
|
||||
"willpower": {
|
||||
"label": "Willpower",
|
||||
"abbrev": "willpower",
|
||||
"value": 0,
|
||||
"bonuseffect": 0,
|
||||
"col": 1,
|
||||
"mod": 0
|
||||
},
|
||||
"knowledge": {
|
||||
"label": "Knowledge",
|
||||
"abbrev": "knowledge",
|
||||
"value": 0,
|
||||
"bonuseffect": 0,
|
||||
"col": 1,
|
||||
"mod": 0
|
||||
},
|
||||
"social": {
|
||||
"label": "Social",
|
||||
"abbrev": "social",
|
||||
"value": 0,
|
||||
"bonuseffect": 0,
|
||||
"col": 1,
|
||||
"mod": 0
|
||||
}
|
||||
},
|
||||
"size": {
|
||||
"label": "Size",
|
||||
"value": ""
|
||||
},
|
||||
"health": {
|
||||
"value": 0,
|
||||
"tmpvalue": 0,
|
||||
"max": 0
|
||||
},
|
||||
"lifeline": {
|
||||
"value": 0,
|
||||
"max": 0
|
||||
},
|
||||
"resistances": {
|
||||
"physical": {
|
||||
"label": "Physical Damage",
|
||||
"abbrev": "physical",
|
||||
"value": 0
|
||||
},
|
||||
"fire": {
|
||||
"label": "Fire Damage",
|
||||
"abbrev": "fire",
|
||||
"iselemental": true,
|
||||
"value": 0
|
||||
},
|
||||
"lightning": {
|
||||
"label": "Lightning Damage",
|
||||
"abbrev": "lightning",
|
||||
"iselemental": true,
|
||||
"value": 0
|
||||
},
|
||||
"cool": {
|
||||
"label": "Cool Damage",
|
||||
"abbrev": "cool",
|
||||
"iselemental": true,
|
||||
"value": 0
|
||||
},
|
||||
"psychic": {
|
||||
"label": "Psychic Damage",
|
||||
"abbrev": "psychic",
|
||||
"value": 0
|
||||
},
|
||||
"dark": {
|
||||
"label": "Dark Damage",
|
||||
"abbrev": "dark",
|
||||
"value": 0
|
||||
},
|
||||
"divine": {
|
||||
"label": "Divine Damage",
|
||||
"abbrev": "divine",
|
||||
"value": 0
|
||||
},
|
||||
"true": {
|
||||
"label": "True Damage",
|
||||
"abbrev": "true",
|
||||
"value": 0
|
||||
}
|
||||
}
|
||||
},
|
||||
"npccore": {
|
||||
"npctype": "",
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"character": {
|
||||
"templates": [
|
||||
"biodata",
|
||||
"core"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Item": {
|
||||
"types": [
|
||||
"skill",
|
||||
"spell",
|
||||
"armor",
|
||||
"shield",
|
||||
"equipment",
|
||||
"weapon",
|
||||
"module",
|
||||
"money"
|
||||
],
|
||||
"skill": {
|
||||
"attribute": "",
|
||||
"value": 0,
|
||||
"description": ""
|
||||
},
|
||||
"spell": {
|
||||
"spelltype": "",
|
||||
"value": 0,
|
||||
"description": ""
|
||||
},
|
||||
"armor": {
|
||||
"weight": 0,
|
||||
"cost": 0,
|
||||
"equipped": false,
|
||||
"locationprotected": "",
|
||||
"description": ""
|
||||
},
|
||||
"shield": {
|
||||
"weight": 0,
|
||||
"cost": 0,
|
||||
"equipped": false,
|
||||
"description": ""
|
||||
},
|
||||
"equipment": {
|
||||
"equiptype": "",
|
||||
"cost": 0,
|
||||
"weight": 0,
|
||||
"quantity": 0,
|
||||
"equipped": false,
|
||||
"description": ""
|
||||
},
|
||||
"money": {
|
||||
"value": 0,
|
||||
"quantity": 0,
|
||||
"weight": 0,
|
||||
"description": ""
|
||||
},
|
||||
"weapon": {
|
||||
"weapontype": "",
|
||||
"cost": 0,
|
||||
"weight": 0,
|
||||
"range": "",
|
||||
"maxrange": "",
|
||||
"equipped": false,
|
||||
"description": ""
|
||||
},
|
||||
"module": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
530
templates/actors/actor-sheet.html
Normal file
@ -0,0 +1,530 @@
|
||||
<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">
|
||||
<div class="ability-item">
|
||||
<ul>
|
||||
{{#each system.attributes as |attribute key|}}
|
||||
{{#if (eq attribute.col 1)}}
|
||||
{{> systems/fvtt-crucible-rpg/templates/actors/partial-actor-attribute-block.html attribute=attribute key=key}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<li class="item flexrow list-item" data-attr-key="class">
|
||||
<span class="ability-label " name="class">
|
||||
<h4 class="ability-text-white ability-margin">Class</h4>
|
||||
</span>
|
||||
<select class="competence-base flexrow" type="text" name="system.biodata.class" value="{{data.biodata.class}}" data-dtype="String">
|
||||
{{#select data.biodata.class}}
|
||||
<option value="chaplain">Chaplain</option>
|
||||
<option value="magus">Magus</option>
|
||||
<option value="martial">Martial</option>
|
||||
<option value="skalawag">Skalawag</option>
|
||||
<option value="warden">Warden</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="ability-item">
|
||||
<ul>
|
||||
{{#each data.abilities as |ability key|}}
|
||||
{{#if (eq ability.col 2)}}
|
||||
{{> systems/fvtt-crucible-rpg/templates/partial-actor-ability-block.html ability=ability key=key}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
|
||||
{{#if equippedArmor}}
|
||||
<li class="item flexrow list-item" data-attr-key="class">
|
||||
<img class="sheet-competence-img" src="{{equippedArmor.img}}" />
|
||||
<span class="ability-label " name="class">
|
||||
<h4 class="ability-text-white ability-margin"><a class="roll-armor-die ability-margin">{{equippedArmor.name}}</a></h4>
|
||||
</span>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if equippedShield}}
|
||||
<li class="item flexrow list-item" data-attr-key="class">
|
||||
<img class="sheet-competence-img" src="{{equippedShield.img}}" />
|
||||
<span class="ability-label " name="equippedShield">
|
||||
<h4 class="ability-text-white ability-margin"><a class="roll-shield-die ability-margin">{{equippedShield.name}}</a></h4>
|
||||
</span>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li class="item flexrow list-item" data-attr-key="class">
|
||||
<img class="sheet-competence-img" src="systems/fvtt-crucible-rpg/images/icons/feats/Marksman (Ballistic).webp" />
|
||||
<span class="ability-label " name="rollTarget">
|
||||
<h4 class="ability-text-white ability-margin"><a class="roll-target-die ability-margin">Target Roll</a></h4>
|
||||
</span>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="ability-item status-block">
|
||||
{{> systems/fvtt-crucible-rpg/templates/partial-actor-status.html}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{{!-- Sheet Tab Navigation --}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
<a class="item" data-tab="skills">Skills</a>
|
||||
<a class="item" data-tab="combat">Combat</a>
|
||||
<a class="item" data-tab="lore">Lore</a>
|
||||
<a class="item" data-tab="equipment">Equipment</a>
|
||||
<a class="item" data-tab="biodata">Biography</a>
|
||||
</nav>
|
||||
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
|
||||
{{!-- Skills Tab --}}
|
||||
<div class="tab skills" data-group="primary" data-tab="skills">
|
||||
|
||||
<ul class="stat-list alternate-list item-list">
|
||||
<li class="item flexrow list-item items-title-bg">
|
||||
<span class="item-name-label-header">
|
||||
<h3><label class="items-title-text">Skills</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Ability</label>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Dice</label>
|
||||
</span>
|
||||
<span class="item-field-label-long">
|
||||
<label class="short-label">Background</label>
|
||||
</span>
|
||||
</li>
|
||||
{{#each skills as |skill key|}}
|
||||
<li class="item stat flexrow list-item list-item-shadow" data-item-id="{{skill._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{skill.img}}" /></a>
|
||||
<span class="item-name-label"><a class="roll-skill">{{skill.name}}</a></span>
|
||||
<span class="item-field-label-short">{{upper skill.system.ability}}</span>
|
||||
<span class="item-field-label-short">{{skill.system.skilldice}}</span>
|
||||
<span class="item-field-label-long"> - </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>
|
||||
|
||||
{{!-- Combat Tab --}}
|
||||
<div class="tab combat" data-group="primary" data-tab="combat">
|
||||
<div class="flexcol">
|
||||
|
||||
<div>
|
||||
<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">Weapons</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Ability</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Range</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-long"><a class ="roll-weapon">{{weapon.name}}</a></span>
|
||||
|
||||
<span class="item-field-label-short">{{weapon.system.ability}}</span>
|
||||
|
||||
<span class="item-field-label-medium">{{perk.system.range}}</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>
|
||||
<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">Feats</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Feature Die?</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">SL?</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">SL</label>
|
||||
</span>
|
||||
</li>
|
||||
{{#each feats as |feat key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-item-id="{{feat._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{feat.img}}" /></a>
|
||||
<span class="item-name-label-long">{{feat.name}}</span>
|
||||
|
||||
<span class="item-field-label-medium">{{upperFirst feat.system.isfeatdie}}</span>
|
||||
<span class="item-field-label-medium">{{upperFirst feat.system.issl}}</span>
|
||||
<span class="item-field-label-medium">{{feat.system.sl}}</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>
|
||||
<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">Conditions</label></h3>
|
||||
</span>
|
||||
</li>
|
||||
{{#each conditions as |condition key|}}
|
||||
<li class="item flexrow list-item list-item-shadow" data-item-id="{{condition._id}}">
|
||||
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
|
||||
src="{{condition.img}}" /></a>
|
||||
<span class="item-name-label-long">{{condition.name}}</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>
|
||||
</div>
|
||||
|
||||
|
||||
{{!-- Lore Tab --}}
|
||||
<div class="tab lore" data-group="primary" data-tab="lore">
|
||||
|
||||
<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">Lore</label></h3>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Lore</label>
|
||||
</span>
|
||||
<span class="item-field-label-short">
|
||||
<label class="short-label">Circle</label>
|
||||
</span>
|
||||
<span class="item-field-label-medium">
|
||||
<label class="short-label">Range</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="power-roll">{{spell.name}}</a>
|
||||
</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.lore}}</span>
|
||||
<span class="item-field-label-short">{{upperFirst spell.system.circle}}</span>
|
||||
<span class="item-field-label-medium">{{upperFirst spell.system.range}}</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>{{upper weapon.system.ability}}</label></span>
|
||||
<span class="item-field-label-short"><label>{{upper 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">{{upper 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">Quantity</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 containersTree as |equip key|}}
|
||||
{{> systems/fvtt-crucible-rpg/templates/partial-actor-equipment.html equip=equip level=1}}
|
||||
<ul class="item-list list-item-shadow2 list-item-margin1">
|
||||
{{#each equip.data.contents as |subgear key|}}
|
||||
{{> systems/fvtt-crucible-rpg/templates/partial-actor-equipment.html equip=subgear level=2}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
|
||||
</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>
|
149
templates/chat/chat-generic-result.html
Normal file
@ -0,0 +1,149 @@
|
||||
<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 (eq rollOrder 1)}}
|
||||
<li><strong>Roll with {{rollType}} - Roll 1</strong></li>
|
||||
{{/if}}
|
||||
{{#if (eq rollOrder 2)}}
|
||||
<li><strong>Roll with {{rollType}} - Roll 2</strong></li>
|
||||
{{/if}}
|
||||
{{#if (eq rollOrder 3)}}
|
||||
<li><strong>Roll with {{rollType}} - Final result !</strong></li>
|
||||
{{/if}}
|
||||
|
||||
{{#if save}}
|
||||
<li>Save : {{save.label}} - {{save.value}}d6
|
||||
({{#each roll.terms.0.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if sizeDice}}
|
||||
<li>Size/Range/Cover/Situational dices
|
||||
({{#each roll.terms.0.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if ability}}
|
||||
<li>Ability : {{ability.label}} - {{ability.value}}d6
|
||||
({{#each roll.terms.0.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if skill}}
|
||||
<li>Skill : {{skill.name}} - {{skill.data.skilldice}}
|
||||
{{#if featSL}}
|
||||
- with Feat SL +{{featSL}}
|
||||
{{/if}}
|
||||
({{#each roll.terms.2.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if noAdvantage}}
|
||||
<li>No advantage due to condition : {{noAdvantage.name}}</li>
|
||||
{{else}}
|
||||
{{#if (or (eq advantage "advantage1") forceAdvantage)}}
|
||||
<li>1 Advantage Die !
|
||||
({{#each roll.terms.8.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if (eq advantage "advantage2") }}
|
||||
<li>2 Advantage Dice !
|
||||
({{#each roll.terms.8.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if (or (eq disadvantage "disadvantage1") forceDisadvantage)}}
|
||||
<li>1 Disadvantage Die !
|
||||
({{#each roll.terms.10.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if (eq disadvantage "disadvantage2")}}
|
||||
<li>2 Disadvantage Dice !
|
||||
({{#each roll.terms.10.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if (eq rollAdvantage "roll-advantage")}}
|
||||
<li>Roll with Advantage !</li>
|
||||
{{/if}}
|
||||
{{#if (eq rollAdvantage "roll-disadvantage")}}
|
||||
<li>Roll with Disadvantage !</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if skillArmorPenalty}}
|
||||
<li>Armor Penalty : {{skillArmorPenalty}} Disadvantage Dice
|
||||
({{#each roll.terms.12.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if hasBonusDice}}
|
||||
<li>Skill bonus dice : {{hasBonusDice}}
|
||||
({{#each roll.terms.6.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if complexSkillDisadvantage}}
|
||||
<li>Roll with Disadvantage because of Complex Skill at SL 0 !</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if hasFeatDie}}
|
||||
<li>Feat Die : d10
|
||||
({{#each roll.terms.4.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if useshield}}
|
||||
<li>Shield : {{shield.name}} - {{shield.data.shielddie}}
|
||||
({{#each roll.terms.14.results as |die idx|}}
|
||||
{{die.result}}
|
||||
{{/each}})
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
<li><strong>Number of successes</strong> {{nbSuccess}} </li>
|
||||
|
||||
<!-- <button class="chat-card-button reroll-level-remaining" data-roll-id="{{rollId}}">Reroll</button> -->
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
167
templates/dialogs/roll-dialog-generic.html
Normal file
@ -0,0 +1,167 @@
|
||||
<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 sizeDice}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Size basic dices : </span>
|
||||
<span class="roll-dialog-label">{{sizeDice.nb}}{{sizeDice.dice}}</span>
|
||||
</div>
|
||||
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Distance bonus dice(s) : </span>
|
||||
<select class="status-small-label color-class-common" type="text" id="distanceBonusDice" value="{{distanceBonusDice}}" data-dtype="String" >
|
||||
{{#select distanceBonusDice}}
|
||||
<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}}
|
||||
|
||||
{{#if hasCover}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Cover : </span>
|
||||
<select class="status-small-label color-class-common" type="text" id="hasCover" value="{{hasCover}}" data-dtype="String" >
|
||||
{{#select hasCover}}
|
||||
<option value="none">None</option>
|
||||
<option value="cover50">Cover at 50% (+1 dice)</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if situational}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Situational : </span>
|
||||
<select class="status-small-label color-class-common" type="text" id="situational" value="{{situational}}" data-dtype="String" >
|
||||
{{#select situational}}
|
||||
<option value="none">None</option>
|
||||
<option value="dodge">Dodge (+1 dice)</option>
|
||||
<option value="prone">Prone (+1 dice)</option>
|
||||
<option value="moving">Moving (+1 dice)</option>
|
||||
<option value="Engaged">Engaged (+1 dice)</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if save}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">{{save.label}} : </span>
|
||||
<span class="roll-dialog-label">{{save.value}}d6</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if ability}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Ability : </span>
|
||||
<span class="roll-dialog-label">{{ability.value}}d6</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if weapon}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Weapon : </span>
|
||||
<span class="roll-dialog-label">{{weapon.name}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if shield}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Use shield ? : </span>
|
||||
<span class="roll-dialog-label"><input type="checkbox" id="useshield" name="useshield" {{checked useshield}}/></span>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">{{shield.name}} : </span>
|
||||
<span class="roll-dialog-label">{{shield.data.shielddie}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if skill}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Skill : </span>
|
||||
<span class="roll-dialog-label">{{skill.name}} - {{skill.data.skilldice}}</span>
|
||||
</div>
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Feature die or SL+2? : </span>
|
||||
<span class="roll-dialog-label">{{#if skill.data.isfeatdie}} Yes {{else}} No {{/if}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if noAdvantage}}
|
||||
<div>
|
||||
<span class="roll-dialog-label">No advantage due to condition : {{noAdvantage.name}}</span>
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Advantage : </span>
|
||||
<select class="status-small-label color-class-common" type="text" id="advantage" value="{{advantage}}" data-dtype="String" >
|
||||
{{#select advantage}}
|
||||
<option value="none">None</option>
|
||||
<option value="advantage1">1 Advantage</option>
|
||||
<option value="advantage2">2 Advantages</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Disadvantage : </span>
|
||||
<select class="status-small-label color-class-common" type="text" id="disadvantage" value="{{disadvantage}}" data-dtype="String" >
|
||||
{{#select disadvantage}}
|
||||
<option value="none">None</option>
|
||||
<option value="disadvantage1">1 Disadvantage</option>
|
||||
<option value="disadvantage2">2 Disadvantages</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Roll with Advantage/Disadvantage : </span>
|
||||
<select class="status-small-label color-class-common" type="text" id="rollAdvantage" value="{{rollAdvantage}}" data-dtype="String" >
|
||||
{{#select rollAdvantage}}
|
||||
<option value="none">None</option>
|
||||
<option value="roll-advantage">Roll with Advantage</option>
|
||||
<option value="roll-disadvantage">Roll with Disadvantage</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{#if forceAdvantage}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">1 Advantage from condition : {{forceAdvantage.name}}
|
||||
{{#if advantageFromTarget}} (Provided by targetted actor) {{/if}}
|
||||
</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if forceDisadvantage}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">1 Disadvantage from condition : {{forceDisadvantage.name}} </span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if forceRollAdvantage}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Roll Advantage from condition : {{forceRollAdvantage.name}} </span>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if forceRollDisadvantage}}
|
||||
<div class="flexrow">
|
||||
<span class="roll-dialog-label">Roll Disadvantage from condition : {{forceRollDisadvantage.name}} </span>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
84
templates/items/item-weapon-sheet.html
Normal file
@ -0,0 +1,84 @@
|
||||
<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-crucible-rpg/templates/partial-item-nav.html}}
|
||||
|
||||
|
||||
{{!-- Sheet Body --}}
|
||||
<section class="sheet-body">
|
||||
|
||||
{{> systems/fvtt-crucible-rpg/templates/partial-item-description.html}}
|
||||
|
||||
<div class="tab details" data-group="primary" data-tab="details">
|
||||
|
||||
<div class="tab" data-group="primary">
|
||||
<ul>
|
||||
<!-- <li class="flexrow"><label class="generic-label">Ability</label>
|
||||
<select class="competence-base flexrow" type="text" name="data.ability" value="{{data.ability}}" data-dtype="String">
|
||||
{{#select data.ability}}
|
||||
{{> systems/fvtt-crucible-rpg/templates/partial-options-abilities.html}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li> -->
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Is proficient ?</label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="system.isproficient" {{checked data.isproficient}}/></label>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Associated skill</label>
|
||||
<select class="competence-base flexrow" type="text" name="system.skill" value="{{data.skill}}" data-dtype="String">
|
||||
{{#select data.skill}}
|
||||
{{#each weaponSkills as |skill idx|}}
|
||||
<option value="{{skill.name}}">{{skill.name}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Qualities (comma separated list)</label>
|
||||
<input type="text" class="padd-right" name="system.qualities" value="{{data.qualities}}" data-dtype="String"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Flaws (comma separated list)</label>
|
||||
<input type="text" class="padd-right" name="system.flaws" value="{{data.flaws}}" data-dtype="String"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Damage</label>
|
||||
<input type="text" class="right" name="system.damage" value="{{data.damage}}" data-dtype="String"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Is ranged weapon ?</label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="system.isranged" {{checked data.isranged}}/></label>
|
||||
</li>
|
||||
{{#if data.isranged}}
|
||||
<li class="flexrow"><label class="generic-label">Effective Range</label>
|
||||
<input type="text" class="right" name="system.range" value="{{data.range}}" data-dtype="String"/>
|
||||
</li>
|
||||
<li class="flexrow"><label class="generic-label">Max range</label>
|
||||
<input type="text" class="right" name="system.maxrange" value="{{data.maxrange}}" data-dtype="String"/>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Minimum strength</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="system.minstr" value="{{data.minstr}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Equipped ?</label>
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="system.equipped" {{checked data.equipped}}/></label>
|
||||
</li>
|
||||
|
||||
<li class="flexrow"><label class="generic-label">Cost</label>
|
||||
<input type="text" class="input-numeric-short padd-right" name="system.cost" value="{{data.cost}}" data-dtype="Number"/>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
</form>
|