diff --git a/modules/pegasus-actor-sheet.js b/modules/pegasus-actor-sheet.js index fd08915..b61ba21 100644 --- a/modules/pegasus-actor-sheet.js +++ b/modules/pegasus-actor-sheet.js @@ -19,7 +19,7 @@ export class PegasusActorSheet extends ActorSheet { height: 720, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "combat" }], dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }], - editScore: false + editScore: true }); } @@ -43,11 +43,10 @@ export class PegasusActorSheet extends ActorSheet { specs: this.actor.getSpecs( ), optionsDiceList: PegasusUtility.getOptionsDiceList(), optionsLevel: PegasusUtility.getOptionsLevel(), - weapons: this.actor.checkAndPrepareWeapons( duplicate(this.actor.getWeapons()) ), - armors: this.actor.checkAndPrepareArmors( duplicate(this.actor.getArmors())), - shields: duplicate(this.actor.getShields()), - equipments: duplicate(this.actor.getEquipments()), - equipments: duplicate(this.actor.getEquipmentsOnly()), + weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ), + armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())), + shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields()) ), + equipments: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquipmentsOnly()) ), perks: duplicate(this.actor.getPerks()), abilities: duplicate(this.actor.getAbilities()), activePerks: duplicate(this.actor.getActivePerks()), @@ -77,12 +76,20 @@ export class PegasusActorSheet extends ActorSheet { let rollData = PegasusUtility.getBasicRollData() rollData.alias = "Dice Pool Roll", rollData.mode = "generic" - rollData.title = `Dice Pool Roll`; + rollData.title = `Dice Pool Roll` + rollData.img = "icons/dice/d12black.svg" let rollDialog = await PegasusRollDialog.create( this.actor, rollData); rollDialog.render( true ); } + /* -------------------------------------------- */ + async rollIDR( diceValue) { + let myRoll = new Roll(diceValue+"x").roll({ async: false }) + //await PegasusUtility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode")) + myRoll.toMessage() + } + /* -------------------------------------------- */ /** @override */ activateListeners(html) { @@ -183,6 +190,15 @@ export class PegasusActorSheet extends ActorSheet { 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('.momentum-minus').click(event => { this.actor.modifyMomentum( -1 ) } ) @@ -222,6 +238,10 @@ export class PegasusActorSheet extends ActorSheet { html.find('.roll-mr').click((event) => { this.actor.rollMR(); }); + html.find('.roll-idr').click((event) => { + const diceValue = $(event.currentTarget).data("dice-value") + this.rollIDR( diceValue) + }) html.find('.roll-spec').click((event) => { const li = $(event.currentTarget).parents(".item"); diff --git a/modules/pegasus-actor.js b/modules/pegasus-actor.js index ec606f7..2de2da6 100644 --- a/modules/pegasus-actor.js +++ b/modules/pegasus-actor.js @@ -116,39 +116,39 @@ export class PegasusActor extends Actor { } /* -------------------------------------------- */ getShields() { - let comp = this.data.items.filter(item => item.type == 'shield'); + let comp = this.data.items.filter(item => item.type == 'shield') return comp; } getRace() { - let race = this.data.items.filter(item => item.type == 'race'); + let race = this.data.items.filter(item => item.type == 'race') return race[0] ?? []; } getRole() { - let role = this.data.items.filter(item => item.type == 'role'); + let role = this.data.items.filter(item => item.type == 'role') return role[0] ?? []; } /* -------------------------------------------- */ - checkAndPrepareArmor(armor) { - armor.data.resistanceDice = PegasusUtility.getDiceFromLevel(armor.data.resistance); - } - /* -------------------------------------------- */ - checkAndPrepareArmors(armors) { - for (let item of armors) { - this.checkAndPrepareArmor(item); + checkAndPrepareEquipment(item) { + if ( item.data.resistance ) { + item.data.resistanceDice = PegasusUtility.getDiceFromLevel(item.data.resistance) + } + if ( item.data.idr ) { + item.data.idrDice = PegasusUtility.getDiceFromLevel(item.data.idr) + } + if ( item.data.damage) { + item.data.damageDice = PegasusUtility.getDiceFromLevel(item.data.damage) + } + if( item.data.level) { + item.data.levelDice = PegasusUtility.getDiceFromLevel(item.data.level) } - return armors; } /* -------------------------------------------- */ - checkAndPrepareWeapon(weapon) { - weapon.data.damageDice = PegasusUtility.getDiceFromLevel(weapon.data.damage); - } - /* -------------------------------------------- */ - checkAndPrepareWeapons(weapons) { - for (let item of weapons) { - this.checkAndPrepareWeapon(item); + checkAndPrepareEquipments(listItem) { + for (let item of listItem) { + this.checkAndPrepareEquipment(item) } - return weapons; + return listItem } /* -------------------------------------------- */ @@ -314,10 +314,11 @@ export class PegasusActor extends Actor { // Compute whole enc let enc = 0 for (let item of equipments) { + item.data.idrDice = PegasusUtility.getDiceFromLevel( Number(item.data.idr)) if (item.data.equipped) { if (item.data.iscontainer) { enc += item.data.contentsEnc - } else { + } else if (item.data.containerid == "") { enc += item.data.weight } } @@ -789,7 +790,7 @@ export class PegasusActor extends Actor { updates['data.secondary.socialhealth.value'] = socDiceValue } - let nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.nrg.mod + this.data.data.statistics.foc.mod; + let nrgValue = PegasusUtility.getDiceValue(this.data.data.statistics.foc.value) + this.data.data.nrg.mod + this.data.data.statistics.foc.mod if (nrgValue != this.data.data.nrg.absolutemax) { updates['data.nrg.absolutemax'] = nrgValue } @@ -823,7 +824,7 @@ export class PegasusActor extends Actor { if (role && role.name && (role.name != this.data.data.biodata.rolename)) { updates['data.biodata.rolename'] = role.name } - console.log("UPD", updates, this.data.data.biodata) + //console.log("UPD", updates, this.data.data.biodata) await this.update(updates) } @@ -878,6 +879,16 @@ export class PegasusActor extends Actor { const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'data.quantity': newQ }]); // pdates one EmbeddedEntity } } + /* -------------------------------------------- */ + async incDecAmmo(objetId, incDec = 0) { + let objetQ = this.data.items.get(objetId) + if (objetQ) { + let newQ = objetQ.data.data.ammocurrent + incDec; + if ( newQ >= 0 && newQ <= objetQ.data.data.ammomax) { + const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'data.ammocurrent': newQ }]); // pdates one EmbeddedEntity + } + } + } /* -------------------------------------------- */ async applyAbility(ability, updates = [], directUpdate = false) { @@ -1082,7 +1093,11 @@ export class PegasusActor extends Actor { rollData.statMod = rollData.stat.mod rollData.specList = this.getRelevantSpec(statKey) rollData.selectedSpec = "0" - rollData.img = `systems/fvtt-pegasus-rpg/images/icons/${rollData.stat.abbrev}.webp` + if (statKey.toLowerCase() == "mr") { + rollData.img = "systems/fvtt-pegasus-rpg/images/icons/MR.webp" + } else { + rollData.img = `systems/fvtt-pegasus-rpg/images/icons/${rollData.stat.abbrev}.webp` + } } this.addEffects(rollData) @@ -1119,6 +1134,7 @@ export class PegasusActor extends Actor { let rollData = this.getCommonRollData(statKey, useShield) rollData.mode = "stat" rollData.title = `Roll : ${stat.label} ` + rollData.img = "icons/dice/d12black.svg" this.startRoll(rollData) } else { @@ -1181,10 +1197,11 @@ export class PegasusActor extends Actor { let rollData = this.getCommonRollData("mr") rollData.mode = "MR" + rollData.img = "systems/fvtt-pegasus-rpg/images/icons/MR.webp" rollData.isInit = isInit rollData.combatId = combatId rollData.combatantId = combatantId - + console.log("MR ROLL", rollData) this.startRoll(rollData); } else { ui.notifications.warn("MR not found !"); @@ -1199,7 +1216,7 @@ export class PegasusActor extends Actor { let rollData = this.getCommonRollData(armor.data.statistic) armor = duplicate(armor); - this.checkAndPrepareArmor(armor); + this.checkAndPrepareEquipment(armor); rollData.mode = "armor" rollData.armor = armor diff --git a/modules/pegasus-utility.js b/modules/pegasus-utility.js index c07444a..a868eb8 100644 --- a/modules/pegasus-utility.js +++ b/modules/pegasus-utility.js @@ -211,6 +211,7 @@ export class PegasusUtility { 'systems/fvtt-pegasus-rpg/templates/partial-actor-status.html', 'systems/fvtt-pegasus-rpg/templates/partial-item-nav.html', 'systems/fvtt-pegasus-rpg/templates/partial-item-description.html', + 'systems/fvtt-pegasus-rpg/templates/partial-actor-equipment.html' ] return loadTemplates(templatePaths); } diff --git a/styles/simple.css b/styles/simple.css index ac8e050..c562fa5 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -540,12 +540,19 @@ ul, li { border-radius: 0.25rem; padding: 0.125rem; flex: 1 1 5rem; + display: flex !important; } .list-item-shadow { background:rgba(87, 60, 32, 0.35); + flex-grow: 0; + flex-wrap: nowrap; + justify-content: flex-start; } .list-item-shadow2 { background:rgba(87, 60, 32, 0.25); + flex-grow: 0; + flex-wrap: nowrap; + justify-content: flex-start; } .item-display-show { display: block; @@ -613,7 +620,6 @@ ul, li { margin: 4px 0; min-width: 96px; } - .short-label { flex-grow: 1; } @@ -928,6 +934,14 @@ ul, li { width: auto; height: auto; } +.small-stat-icon { + border: 0; + padding: 2px 2px 2px 2px; + max-width:16px; + max-height:16px; + width: auto; + height: auto; +} .combat-icon { border: 0; padding: 2px 2px 2px 2px; @@ -1155,11 +1169,11 @@ ul, li { display: inline-block; cursor: pointer; color: #ffffff; - padding: 2px 6px 0px 6px; + padding: 0px 6px 0px 6px; text-decoration: none; text-shadow: 0px 1px 0px #4d3534; position: relative; - margin:3px; + margin:0px; } .river-button:hover, @@ -1316,8 +1330,8 @@ Focus FOC: #ff0084 margin-top: 4px; } .no-grow { - flex-grow: 1; - max-width: 24px; + flex-grow: 1; + max-width: 32px; } .status-col-name { max-width: 72px; @@ -1370,6 +1384,9 @@ Focus FOC: #ff0084 background: black; color: white; } +.items-title-text { + margin-left: 4px; +} .lock-icon { width:16px; height: 16px; @@ -1377,4 +1394,54 @@ Focus FOC: #ff0084 .item-sheet-img { width: 64px; height: auto; +} +.item-name-img { + flex-grow:1; + max-width: 2rem; + min-width: 2rem; +} +.item-name-label-header { + flex-grow:2; + max-width: 12rem; + min-width: 12rem; +} +.item-name-label { + flex-grow:2; + max-width: 10rem; + min-width: 10rem; +} +.item-name-label-level2 { + flex-grow:2; + max-width: 9rem; + min-width: 9rem; +} +.item-field-label-short { + flex-grow:1; + max-width: 4rem; + min-width: 4rem; +} +.item-field-label-medium { + flex-grow:1; + max-width: 6rem; + min-width: 6rem; +} +.item-field-label-long { + flex-grow:1; + max-width: 8rem; + min-width: 8rem; +} +.item-control-end { + align-self: flex-end; +} +.alternate-list { + margin-top: 4px; + flex-wrap: nowrap; +} +.item-filler { + flex-grow: 6; + flex-shrink: 7; +} +.item-controls-fixed { + min-width:2rem; + max-width: 2rem; } \ No newline at end of file diff --git a/system.json b/system.json index 9b9f4dd..1ffee4f 100644 --- a/system.json +++ b/system.json @@ -180,9 +180,9 @@ "styles": [ "styles/simple.css" ], - "templateVersion": 86, + "templateVersion": 87, "title": "Pegasus RPG", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", - "version": "0.5.4", + "version": "0.5.5", "background" : "./images/ui/pegasus_welcome_page.webp" } diff --git a/template.json b/template.json index f9646b2..cbe07e7 100644 --- a/template.json +++ b/template.json @@ -390,6 +390,7 @@ "value": 0, "quantity": 0, "weight": 0, + "idr":"", "description": "" }, "weapon": { diff --git a/templates/actor-sheet.html b/templates/actor-sheet.html index 9239efc..f359de7 100644 --- a/templates/actor-sheet.html +++ b/templates/actor-sheet.html @@ -43,7 +43,7 @@ @@ -159,27 +159,57 @@
- -

Perks

-
-
-

Effects

-
- - + {{!-- Other Tab --}}
-
- -

Specialisations

-
- -

Powers

-
- -

Abilities

-
-
-

Money

-
-
-

Weapons

-
-
-

Armors & Shields

-
+ + -
-

Equipment

-
diff --git a/templates/partial-actor-equipment.html b/templates/partial-actor-equipment.html new file mode 100644 index 0000000..096f6fd --- /dev/null +++ b/templates/partial-actor-equipment.html @@ -0,0 +1,49 @@ +
  • + + {{#if (eq level 1)}} + {{equip.name}} + {{else}} + {{equip.name}} + {{/if}} + {{upperFirst equip.data.type}} + + + + + {{#if (count equip.data.effects)}} + {{#if equip.data.activated}} + Deactivate + {{else}} + Activate + {{/if}} + {{else}} +  -  + {{/if}} + + + {{#if equip.data.iscontainer}} + {{equip.data.contentsEnc}} + {{else}} + N/A + {{/if}} + + + {{#if equip.data.idrDice}} + {{equip.data.idrDice}} + {{else}} +  -  + {{/if}} + + +
     
    +
    + {{#if (eq level 1)}} + {{#if equip.data.equipped}}{{else}}{{/if}} + {{/if}} + +
    +
  • diff --git a/templates/partial-actor-status.html b/templates/partial-actor-status.html index e7d28d6..a2c0c9c 100644 --- a/templates/partial-actor-status.html +++ b/templates/partial-actor-status.html @@ -37,10 +37,10 @@ - +