Allow items

This commit is contained in:
sladecraven 2022-02-16 17:43:51 +01:00
parent 7da8f7d9f1
commit 04afb7a424
15 changed files with 348 additions and 194 deletions

View File

@ -115,7 +115,18 @@ export class PegasusActorSheet extends ActorSheet {
let itemId = li.data("item-id");
this.actor.specPowerDeactivate( itemId)
});
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('.effect-used').click(ev => {
const li = $(ev.currentTarget).parents(".item");
let itemId = li.data("item-id");

View File

@ -435,6 +435,36 @@ export class PegasusActor extends Actor {
this.updateEmbeddedDocuments('Item', [{ _id: specId, 'data.powersactivated': false }])
}
/* -------------------------------------------- */
equipActivate(itemId) {
let item = this.items.get(itemId)
if (item) {
let effects = []
for (let effect of item.data.data.effects) {
effect.data.itemId = itemId // Keep link
effects.push(effect)
}
if (effects.length > 0) {
this.createEmbeddedDocuments('Item', effects )
}
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.activated': true }])
}
}
/* -------------------------------------------- */
equipDeactivate(itemId) {
let toRem = []
for (let item of this.data.items) {
if (item.data.data.itemId && item.data.data.itemId == itemId) {
toRem.push(item.id)
}
}
if (toRem.length > 0) {
this.deleteEmbeddedDocuments('Item', toRem)
}
this.updateEmbeddedDocuments('Item', [{ _id: itemId, 'data.activated': false }])
}
/* -------------------------------------------- */
async perkEffectUsed(itemId) {
let effect = this.items.get(itemId)
@ -547,6 +577,10 @@ export class PegasusActor extends Actor {
await this.update({ 'data.nrg': nrg })
}
this.disableWeaverPerk(item)
PegasusUtility.createChatWithRollMode(item.name, {
content: await renderTemplate(`systems/fvtt-pegasus-rpg/templates/chat-perk-ready.html`, { name: this.name, perk: item })
});
}
if (status == "activated") {
// Add effects linked to the perk
@ -875,10 +909,10 @@ export class PegasusActor extends Actor {
&& (effect.data.stataffected != "notapplicable" || effect.data.specaffected.length > 0)
&& effect.data.stataffected != "special") {
if (effect.data.effectstatlevel) {
if ( effect.data.effectstat == rollData.statKey ) {
if (effect.data.effectstat == rollData.statKey) {
effect.data.effectlevel = rollData.statDicesLevel
}
if ( effect.data.stataffected == "all") { // Real nightmare
if (effect.data.stataffected == "all") { // Real nightmare
effect.data.effectlevel = this.data.data.statistics[effect.data.effectstat].value
}
}

View File

@ -7,16 +7,16 @@ import { PegasusUtility } from "./pegasus-utility.js";
export class PegasusItemSheet extends ItemSheet {
/** @override */
static get defaultOptions() {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
classes: ["fvtt-pegasus-rpg", "sheet", "item"],
template: "systems/fvtt-pegasus-rpg/templates/item-sheet.html",
dragDrop: [{dragSelector: null, dropSelector: null}],
width: 620,
height: 550
classes: ["fvtt-pegasus-rpg", "sheet", "item"],
template: "systems/fvtt-pegasus-rpg/templates/item-sheet.html",
dragDrop: [{ dragSelector: null, dropSelector: null }],
width: 620,
height: 550
//tabs: [{navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description"}]
});
});
}
/* -------------------------------------------- */
@ -28,28 +28,28 @@ export class PegasusItemSheet extends ItemSheet {
{
class: "post",
icon: "fas fa-comment",
onclick: ev => {}
onclick: ev => { }
})
return buttons
}
/* -------------------------------------------- */
/** @override */
setPosition(options={}) {
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')) {
if (this.item.type.includes('weapon')) {
position.width = 640;
}
return position;
}
/* -------------------------------------------- */
async getData() {
const objectData = PegasusUtility.data(this.object);
let itemData = foundry.utils.deepClone(PegasusUtility.templateData(this.object));
let formData = {
title: this.title,
@ -61,14 +61,14 @@ export class PegasusItemSheet extends ItemSheet {
cssClass: this.isEditable ? "editable" : "locked",
optionsDiceList: PegasusUtility.getOptionsDiceList(),
optionsStatusList: PegasusUtility.getOptionsStatusList(),
data: itemData,
data: itemData,
limited: this.object.limited,
options: this.options,
owner: this.document.isOwner,
mr: (this.object.type == 'specialisation'),
isGM: game.user.isGM
isGM: game.user.isGM
}
this.options.editable = !(this.object.data.origin == "embeddedItem");
console.log("ITEM DATA", formData, this);
return formData;
@ -85,7 +85,7 @@ export class PegasusItemSheet extends ItemSheet {
});
return buttons
}
/* -------------------------------------------- */
postItem() {
let chatData = duplicate(PegasusUtility.data(this.item));
@ -114,8 +114,8 @@ export class PegasusItemSheet extends ItemSheet {
let field = $(ev.currentTarget).data('type');
let idx = Number($(ev.currentTarget).data('index'));
let itemData = this.object.data.data[field][idx];
if ( itemData.name != 'None') {
let spec = await Item.create(itemData, {temporary: true});
if (itemData.name != 'None') {
let spec = await Item.create(itemData, { temporary: true });
spec.data.origin = "embeddedItem";
new PegasusItemSheet(spec).render(true);
}
@ -127,22 +127,22 @@ export class PegasusItemSheet extends ItemSheet {
let idx = Number($(ev.currentTarget).data('index'));
let oldArray = this.object.data.data[field];
let itemData = this.object.data.data[field][idx];
if ( itemData.name != 'None') {
if (itemData.name != 'None') {
let newArray = [];
for( var i = 0; i < oldArray.length; i++) {
if ( i != idx) {
newArray.push( oldArray[i]);
for (var i = 0; i < oldArray.length; i++) {
if (i != idx) {
newArray.push(oldArray[i]);
}
}
this.object.update( { [`data.${field}`]: newArray} );
this.object.update({ [`data.${field}`]: newArray });
}
}
/* -------------------------------------------- */
async manageSpec( ) {
async manageSpec() {
let itemData = this.object.data.data.specialisation[0];
if ( itemData.name != 'None') {
let spec = await Item.create(itemData, {temporary: true});
if (itemData.name != 'None') {
let spec = await Item.create(itemData, { temporary: true });
spec.data.origin = "embeddedItem";
new PegasusItemSheet(spec).render(true);
}
@ -150,12 +150,12 @@ export class PegasusItemSheet extends ItemSheet {
/* -------------------------------------------- */
/** @override */
activateListeners(html) {
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 => {
@ -163,20 +163,20 @@ export class PegasusItemSheet extends ItemSheet {
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-spec').click(ev => {
this.object.update({ "data.specialisation": [{ name: 'None' }] });
});
html.find('.delete-subitem').click( ev => {
this.deleteSubitem( ev );
html.find('.delete-subitem').click(ev => {
this.deleteSubitem(ev);
});
html.find('.stat-choice-flag').click( ev => {
html.find('.stat-choice-flag').click(ev => {
let idx = $(ev.currentTarget).data("stat-idx");
let array = duplicate(this.object.data.data.statincreasechoice);
array[Number(idx)].flag = !array[Number(idx)].flag;
this.object.update( {"data.statincreasechoice": array} );
this.object.update({ "data.statincreasechoice": array });
});
// Update Inventory Item
@ -187,11 +187,11 @@ export class PegasusItemSheet extends ItemSheet {
});
html.find('.view-subitem').click(ev => {
this.viewSubitem( ev );
this.viewSubitem(ev);
});
html.find('.view-spec').click(ev => {
this.manageSpec( );
this.manageSpec();
});
}
@ -199,280 +199,301 @@ export class PegasusItemSheet extends ItemSheet {
/* -------------------------------------------- */
async addAbility(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
newItem._id = randomID(dataItem.id.length);
console.log("ABB", event, item, dataItem)
if ( event.toElement.className == 'drop-abilities') {
if (event.toElement.className == 'drop-abilities') {
let abilityArray = duplicate(this.object.data.data.abilities);
abilityArray.push( newItem);
await this.object.update( { 'data.abilities': abilityArray} );
abilityArray.push(newItem);
await this.object.update({ 'data.abilities': abilityArray });
}
if ( event.toElement.className == 'drop-optionnal-abilities') {
if (event.toElement.className == 'drop-optionnal-abilities') {
let abilityArray = duplicate(this.object.data.data.optionnalabilities);
abilityArray.push( newItem);
await this.object.update( { 'data.optionnalabilities': abilityArray} );
abilityArray.push(newItem);
await this.object.update({ 'data.optionnalabilities': abilityArray });
}
}
/* -------------------------------------------- */
async addRacePerk(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
if ( event.toElement.className == 'drop-race-perk') {
newItem._id = randomID(dataItem.id.length);
if (event.toElement.className == 'drop-race-perk') {
let perkArray = duplicate(this.object.data.data.perks);
perkArray.push( newItem);
await this.object.update( { 'data.perks': perkArray} );
perkArray.push(newItem);
await this.object.update({ 'data.perks': perkArray });
}
}
/* -------------------------------------------- */
async addSpecialisation(item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
let specArray = [ newItem ];
await this.object.update( { 'data.specialisation': specArray} );
newItem._id = randomID(dataItem.id.length);
let specArray = [newItem];
await this.object.update({ 'data.specialisation': specArray });
}
/* -------------------------------------------- */
async addRoleSpecialisation(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
newItem._id = randomID(dataItem.id.length);
console.log("Add spec", event, newItem);
if ( event.toElement.className == 'drop-spec1') {
if (event.toElement.className == 'drop-spec1') {
let specArray = duplicate(this.object.data.data.specialisationsplus1);
specArray.push( newItem );
await this.object.update( { 'data.specialisationsplus1': specArray} );
specArray.push(newItem);
await this.object.update({ 'data.specialisationsplus1': specArray });
}
if ( event.toElement.className == 'drop-spec2') {
if (event.toElement.className == 'drop-spec2') {
let specArray = duplicate(this.object.data.data.specincrease);
specArray.push( newItem );
await this.object.update( { 'data.specincrease': specArray} );
specArray.push(newItem);
await this.object.update({ 'data.specincrease': specArray });
}
}
/* -------------------------------------------- */
async addRolePerk(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
newItem._id = randomID(dataItem.id.length);
console.log("Add spec", event, newItem);
if ( event.toElement.className == 'drop-perk2') {
if (event.toElement.className == 'drop-perk2') {
let perkArray = duplicate(this.object.data.data.perks);
perkArray.push( newItem );
await this.object.update( { 'data.perks': perkArray} );
}
if ( event.toElement.className == 'drop-specialperk1') {
perkArray.push(newItem);
await this.object.update({ 'data.perks': perkArray });
}
if (event.toElement.className == 'drop-specialperk1') {
let perkArray = duplicate(this.object.data.data.specialperk);
perkArray.push( newItem );
await this.object.update( { 'data.specialperk': perkArray} );
perkArray.push(newItem);
await this.object.update({ 'data.specialperk': perkArray });
}
}
/* -------------------------------------------- */
async addPower( event, item, dataItem) {
async addPower(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
if ( event.toElement.className == 'drop-spec-power') {
newItem._id = randomID(dataItem.id.length);
if (event.toElement.className == 'drop-spec-power') {
let powArray = duplicate(this.object.data.data.powers);
powArray.push( newItem );
await this.object.update( { 'data.powers': powArray} );
}
powArray.push(newItem);
await this.object.update({ 'data.powers': powArray });
}
}
/* -------------------------------------------- */
async addAbilityPower( event, item, dataItem) {
async addAbilityPower(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
if ( event.toElement.className == 'drop-ability-power') {
newItem._id = randomID(dataItem.id.length);
if (event.toElement.className == 'drop-ability-power') {
let powArray = duplicate(this.object.data.data.powersgained);
powArray.push( newItem );
await this.object.update( { 'data.powersgained': powArray} );
}
powArray.push(newItem);
await this.object.update({ 'data.powersgained': powArray });
}
}
/* -------------------------------------------- */
async addAbilityEffect( event, item, dataItem) {
async addAbilityEffect(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
if ( event.toElement.className == 'drop-ability-effect') {
newItem._id = randomID(dataItem.id.length);
if (event.toElement.className == 'drop-ability-effect') {
let powArray = duplicate(this.object.data.data.effectsgained);
powArray.push( newItem );
await this.object.update( { 'data.effectsgained': powArray} );
}
powArray.push(newItem);
await this.object.update({ 'data.effectsgained': powArray });
}
}
/* -------------------------------------------- */
async addAbilitySpec( event, item, dataItem) {
async addAbilitySpec(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
if ( event.toElement.className == 'drop-ability-spec') {
newItem._id = randomID(dataItem.id.length);
if (event.toElement.className == 'drop-ability-spec') {
let powArray = duplicate(this.object.data.data.specialisations);
powArray.push( newItem );
await this.object.update( { 'data.specialisations': powArray} );
}
powArray.push(newItem);
await this.object.update({ 'data.specialisations': powArray });
}
}
/* -------------------------------------------- */
async addAbilityWeaponArmor( event, item, dataItem) {
async addAbilityWeaponArmor(event, item, dataItem) {
let newItem = duplicate(item.data);
newItem._id = randomID( dataItem.id.length );
if ( event.toElement.className == 'drop-ability-weapon') {
newItem._id = randomID(dataItem.id.length);
if (event.toElement.className == 'drop-ability-weapon') {
let weaponArray = duplicate(this.object.data.data.attackgained);
weaponArray.push( newItem );
await this.object.update( { 'data.attackgained': weaponArray} );
}
if ( event.toElement.className == 'drop-ability-armor') {
weaponArray.push(newItem);
await this.object.update({ 'data.attackgained': weaponArray });
}
if (event.toElement.className == 'drop-ability-armor') {
let armorArray = duplicate(this.object.data.data.armorgained);
armorArray.push( newItem );
await this.object.update( { 'data.armorgained': armorArray} );
}
armorArray.push(newItem);
await this.object.update({ 'data.armorgained': armorArray });
}
}
/* -------------------------------------------- */
async addPerkSpecialisation( event, item, dataItem) {
async addPerkSpecialisation(event, item, dataItem) {
let newItem = duplicate(item.data);
if ( event.toElement.className == 'drop-spec-perk') {
if (event.toElement.className == 'drop-spec-perk') {
//console.log("PER SPEC", event)
let key = event.toElement.dataset["key"];
if ( key == 'affectedspec') {
await this.object.update( { 'data.features.affectedspec.value': newItem.name} );
if (key == 'affectedspec') {
await this.object.update({ 'data.features.affectedspec.value': newItem.name });
} else {
await this.object.update( { 'data.features.gainspecdice.value': newItem.name} );
await this.object.update({ 'data.features.gainspecdice.value': newItem.name });
}
}
}
/* -------------------------------------------- */
async addPerkEffect( event, item, dataItem) {
async addPerkEffect(event, item, dataItem) {
let newItem = duplicate(item.data)
if ( event.toElement.className == 'drop-perk-effect') {
if (event.toElement.className == 'drop-perk-effect') {
let effectArray = duplicate(this.object.data.data.effectsgained)
effectArray.push( newItem )
await this.object.update( { 'data.effectsgained': effectArray} )
}
}
/* -------------------------------------------- */
async addEffectPower( event, item, dataItem) {
let newItem = duplicate(item.data)
if ( event.toElement.className == 'drop-power-effect') {
let effectArray = duplicate(this.object.data.data.effectsgained)
effectArray.push( newItem );
await this.object.update( { 'data.effectsgained': effectArray} )
effectArray.push(newItem)
await this.object.update({ 'data.effectsgained': effectArray })
}
}
/* -------------------------------------------- */
async addEffectSpec( event, item, dataItem) {
let newItem = duplicate(item.data);
if ( event.toElement.className == 'drop-effect-spec') {
let specArray = duplicate(this.object.data.data.recoveryrollspec);
specArray.push( newItem );
await this.object.update( { 'data.recoveryrollspec': specArray} );
}
if ( event.toElement.className =='drop-effect-specaffected') {
let specArray = duplicate(this.object.data.data.specaffected);
specArray.push( newItem );
await this.object.update( { 'data.specaffected': specArray} );
async addEffectPower(event, item, dataItem) {
let newItem = duplicate(item.data)
if (event.toElement.className == 'drop-power-effect') {
let effectArray = duplicate(this.object.data.data.effectsgained)
effectArray.push(newItem);
await this.object.update({ 'data.effectsgained': effectArray })
}
}
/* -------------------------------------------- */
async addEffectSpec(event, item, dataItem) {
let newItem = duplicate(item.data);
if (event.toElement.className == 'drop-effect-spec') {
let specArray = duplicate(this.object.data.data.recoveryrollspec);
specArray.push(newItem);
await this.object.update({ 'data.recoveryrollspec': specArray });
}
if (event.toElement.className == 'drop-effect-specaffected') {
let specArray = duplicate(this.object.data.data.specaffected);
specArray.push(newItem);
await this.object.update({ 'data.specaffected': specArray });
}
}
/* -------------------------------------------- */
async addEffectItem(event, item, dataItem) {
let newItem = duplicate(item.data);
if (event.toElement.className == 'drop-equipment-effect') {
let effectArray = duplicate(this.object.data.data.effects);
effectArray.push(newItem);
await this.object.update({ 'data.effects': effectArray });
}
}
/* -------------------------------------------- */
async _onDrop(event) {
if (this.object.type == 'power' ) {
if (this.object.type == 'weapon' || this.object.type == 'shield' || this.object.type == 'armor' || this.object.type == 'shield') {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse( data );
let item = await PegasusUtility.searchItem( dataItem);
if ( item.data.type == 'effect') {
return this.addEffectPower( event, item, dataItem);
let dataItem = JSON.parse(data);
let item = await PegasusUtility.searchItem(dataItem);
if (item.data.type == 'effect') {
return this.addEffectItem(event, item, dataItem);
}
}
}
if (this.object.type == 'effect' ) {
if (this.object.type == 'power') {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse( data );
let item = await PegasusUtility.searchItem( dataItem);
if ( item.data.type == 'specialisation') {
return this.addEffectSpec( event, item, dataItem);
let dataItem = JSON.parse(data);
let item = await PegasusUtility.searchItem(dataItem);
if (item.data.type == 'effect') {
return this.addEffectPower(event, item, dataItem);
}
}
}
if (this.object.type == 'race' ) {
if (this.object.type == 'effect') {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse( data );
let item = await PegasusUtility.searchItem( dataItem);
if ( item.data.type == 'ability') {
return this.addAbility( event, item, dataItem);
}
if ( item.data.type == 'perk') {
return this.addRacePerk( event, item, dataItem);
let dataItem = JSON.parse(data);
let item = await PegasusUtility.searchItem(dataItem);
if (item.data.type == 'specialisation') {
return this.addEffectSpec(event, item, dataItem);
}
}
}
if (this.object.type == 'perk' ) {
if (this.object.type == 'race') {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse(data);
let item = await PegasusUtility.searchItem(dataItem);
if (item.data.type == 'ability') {
return this.addAbility(event, item, dataItem);
}
if (item.data.type == 'perk') {
return this.addRacePerk(event, item, dataItem);
}
}
}
if (this.object.type == 'perk') {
let data = event.dataTransfer.getData('text/plain')
if (data) {
let dataItem = JSON.parse( data );
let item = await PegasusUtility.searchItem( dataItem)
if ( item.data.type == 'specialisation') {
return this.addPerkSpecialisation( event, item, dataItem)
let dataItem = JSON.parse(data);
let item = await PegasusUtility.searchItem(dataItem)
if (item.data.type == 'specialisation') {
return this.addPerkSpecialisation(event, item, dataItem)
}
if (item.data.type == 'effect') {
return this.addPerkEffect(event, item, dataItem);
}
if ( item.data.type == 'effect') {
return this.addPerkEffect( event, item, dataItem);
}
}
}
if (this.object.type == 'specialisation' ) {
if (this.object.type == 'specialisation') {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse( data );
let item = await PegasusUtility.searchItem( dataItem);
if ( item.data.type == 'power') {
return this.addPower( event, item, dataItem);
let dataItem = JSON.parse(data);
let item = await PegasusUtility.searchItem(dataItem);
if (item.data.type == 'power') {
return this.addPower(event, item, dataItem);
}
}
}
if (this.object.type == 'ability' ) {
if (this.object.type == 'ability') {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse( data );
let item = await PegasusUtility.searchItem( dataItem);
if ( item.data.type == 'effect') {
return this.addAbilityEffect( event, item, dataItem);
let dataItem = JSON.parse(data);
let item = await PegasusUtility.searchItem(dataItem);
if (item.data.type == 'effect') {
return this.addAbilityEffect(event, item, dataItem);
}
if ( item.data.type == 'power') {
return this.addAbilityPower( event, item, dataItem);
if (item.data.type == 'power') {
return this.addAbilityPower(event, item, dataItem);
}
if ( item.data.type == 'specialisation') {
return this.addAbilitySpec( event, item, dataItem);
if (item.data.type == 'specialisation') {
return this.addAbilitySpec(event, item, dataItem);
}
if ( item.data.type == 'weapon' || item.data.type == 'armor') {
return this.addAbilityWeaponArmor( event, item, dataItem);
if (item.data.type == 'weapon' || item.data.type == 'armor') {
return this.addAbilityWeaponArmor(event, item, dataItem);
}
}
}
if (this.object.type == 'role' ) {
if (this.object.type == 'role') {
let data = event.dataTransfer.getData('text/plain');
if (data) {
let dataItem = JSON.parse( data );
let item = await PegasusUtility.searchItem( dataItem);
if ( item.data.type == 'specialisation') {
return this.addRoleSpecialisation( event, item, dataItem);
let dataItem = JSON.parse(data);
let item = await PegasusUtility.searchItem(dataItem);
if (item.data.type == 'specialisation') {
return this.addRoleSpecialisation(event, item, dataItem);
}
if ( item.data.type == 'perk') {
return this.addRolePerk( event, item, dataItem);
if (item.data.type == 'perk') {
return this.addRolePerk(event, item, dataItem);
}
}
}
ui.notifications.warn("This item can not be dropped over another item");
}
/* -------------------------------------------- */
get template() {
let type = this.item.type;

View File

@ -187,7 +187,8 @@ export class PegasusUtility {
'systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html',
'systems/fvtt-pegasus-rpg/templates/partial-options-level.html',
'systems/fvtt-pegasus-rpg/templates/partial-options-range.html',
'systems/fvtt-pegasus-rpg/templates/partial-options-equipment-types.html'
'systems/fvtt-pegasus-rpg/templates/partial-options-equipment-types.html',
'systems/fvtt-pegasus-rpg/templates/partial-equipment-effects.html'
]
return loadTemplates(templatePaths);
}

View File

@ -1164,6 +1164,7 @@ ul, li {
padding-left: 2rem;
}
.drop-equipment-effect,
.drop-power-effect,
.drop-perk-effect,
.drop-ability-effect,

View File

@ -180,9 +180,9 @@
"styles": [
"styles/simple.css"
],
"templateVersion": 78,
"templateVersion": 80,
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "0.4.14",
"version": "0.4.16",
"background" : "./images/ui/pegasus_welcome_page.webp"
}

View File

@ -339,6 +339,8 @@
"idr": "",
"equipped": false,
"locationprotected": "",
"effects": [],
"activated": false,
"description":""
},
"shield": {
@ -348,6 +350,8 @@
"cost": 0,
"idr": "",
"equipped": false,
"effects": [],
"activated": false,
"description":""
},
"equipment": {
@ -362,6 +366,8 @@
"statdice": false,
"bonusdice": false,
"otherdice": false,
"effects": [],
"activated": false,
"description":""
},
"money" : {
@ -390,6 +396,8 @@
"ammocurrent": 0,
"ammomax": 0,
"equipped": false,
"effects": [],
"activated": false,
"description": ""
}
}

View File

@ -406,6 +406,18 @@
<img class="sheet-competence-img" src="{{equip.img}}" />
<span class="equipement-label">{{equip.name}}</span>
<span class="equipement-label">{{upperFirst equip.data.type}}</span>
<span class="generic-label">Qty {{equip.data.quantity}}</span>
{{#if (count equip.data.effects)}}
{{#if equip.data.activated}}
<span class="stat-label"><a class="equip-deactivate">Deactivate</a></span>
{{else}}
<span class="stat-label"><a class="equip-activate">Activate</a></span>
{{/if}}
{{else}}
<span class="stat-label">&nbsp;</span>
{{/if}}
<span class="generic-label">Qty {{equip.data.quantity}}</span>
<div class="item-controls">
<a class="item-control item-equip" title="Worn">{{#if equip.data.equipped}}<i
@ -426,6 +438,17 @@
<li class="item flexrow list-item" data-item-id="{{weapon._id}}">
<img class="sheet-competence-img" src="{{weapon.img}}" />
<span class="equipement-label">{{weapon.name}}</span>
{{#if (count weapon.data.effects)}}
{{#if weapon.data.activated}}
<span class="stat-label"><a class="equip-deactivate">Deactivate</a></span>
{{else}}
<span class="stat-label"><a class="equip-activate">Activate</a></span>
{{/if}}
{{else}}
<span class="stat-label">&nbsp;</span>
{{/if}}
<div class="item-controls">
<a class="item-control item-equip" title="Worn">{{#if weapon.data.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
@ -445,6 +468,17 @@
<li class="item flexrow list-item" data-item-id="{{armor._id}}">
<img class="sheet-competence-img" src="{{armor.img}}" />
<span class="equipement-label">{{armor.name}}</span>
{{#if (count armor.data.effects)}}
{{#if armor.data.activated}}
<span class="stat-label"><a class="equip-deactivate">Deactivate</a></span>
{{else}}
<span class="stat-label"><a class="equip-activate">Activate</a></span>
{{/if}}
{{else}}
<span class="stat-label">&nbsp;</span>
{{/if}}
<div class="item-controls">
<a class="item-control item-equip" title="Worn">{{#if armor.data.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
@ -457,6 +491,17 @@
<li class="item flexrow list-item" data-item-id="{{shield._id}}">
<img class="sheet-competence-img" src="{{shield.img}}" />
<span class="equipement-label">{{shield.name}}</span>
{{#if (count shield.data.effects)}}
{{#if shield.data.activated}}
<span class="stat-label"><a class="equip-deactivate">Deactivate</a></span>
{{else}}
<span class="stat-label"><a class="equip-activate">Activate</a></span>
{{/if}}
{{else}}
<span class="stat-label">&nbsp;</span>
{{/if}}
<div class="item-controls">
<a class="item-control item-equip" title="Worn">{{#if shield.data.equipped}}<i
class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>

View File

@ -0,0 +1,7 @@
<div class="post-item" data-transfer="{{transfer}}">
<h3><b>{{name}}</b></h3>
{{#if img}}
<img class="chat-img" src="{{img}}" title="{{name}}" />
{{/if}}
<div>{{name}} has Just Deactivated the Perk: {{perk.name}}, make sure to manually delete all Effects provided by this Perk from Targets.</div>
</div>

View File

@ -83,6 +83,7 @@
</li>
</li>
<!--
<li class="flexrow"><label class="generic-label">AoE</label>
<input type="text" class="padd-right" name="data.aoe" value="{{data.aoe}}" data-dtype="String"/>
</li>
@ -99,7 +100,8 @@
{{/select}}
</select>
</li>
-->
<li class="flexrow"><label class="generic-label">Attacks Gained</label>
<li>
<ul class="ul-level1">

View File

@ -30,6 +30,8 @@
<input type="text" class="" name="data.locationprotected" value="{{data.locationprotected}}" data-dtype="String"/>
</li>
{{> systems/fvtt-pegasus-rpg/templates/partial-equipment-effects.html}}
<li class="flexrow"><label class="generic-label">Equipped ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.equipped" {{checked data.equipped}}/></label>
</li>

View File

@ -43,6 +43,7 @@
<label class="attribute-value checkbox"><input type="checkbox" name="data.otherdice" {{checked data.otherdice}}/></label>
</li>
{{> systems/fvtt-pegasus-rpg/templates/partial-equipment-effects.html}}
<li class="flexrow"><label class="generic-label">Equipped ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.equipped" {{checked data.equipped}}/></label>

View File

@ -26,6 +26,9 @@
{{/select}}
</select>
</li>
{{> systems/fvtt-pegasus-rpg/templates/partial-equipment-effects.html}}
<li class="flexrow"><label class="generic-label">Equipped ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="data.equipped" {{checked data.equipped}}/></label>
</li>

View File

@ -88,6 +88,8 @@
</select>
</li>
{{> systems/fvtt-pegasus-rpg/templates/partial-equipment-effects.html}}
<li class="flexrow"><label class="generic-label">Vehicle Damage Type Level</label>
<input type="text" class="input-numeric-short padd-right" name="data.vehicledamagetypelevel" value="{{data.vehicledamagetypelevel}}" data-dtype="Number"/>
</li>

View File

@ -0,0 +1,16 @@
<li class="flexrow"><label class="generic-label">Effects</label>
</li>
<li>
<ul class="ul-level1">
<li class="flexrow"><div class="drop-equipment-effect"><label>Drop Effects here !</label></div>
</li>
{{#each data.effects as |effect idx|}}
<li class="flexrow">
<label name="data.effects[{{idx}}].name"><a class="view-subitem" data-type="effects" data-index="{{idx}}">{{effect.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="effects" data-index="{{idx}}" title="Delete Effect"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</li>