Skip to content

Commit

Permalink
Merge pull request #687 from WookieeMatt/beta-into-main
Browse files Browse the repository at this point in the history
v4.3.4 - Beta into main
  • Loading branch information
phildominguez authored May 25, 2024
2 parents 468bc52 + 9c84d82 commit 8c65dce
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 22 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/github-actions-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ jobs:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."

- name: Check out repository code
uses: actions/checkout@v2
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 17.9.x
cache: npm
- run: npm ci

- name: Compile the compendiums
run: gulp compile

- name: Create system archive
run: |
zip --recurse-paths ./Essence20.zip \
Expand All @@ -32,11 +36,17 @@ jobs:
packs/ \
css/ \
templates/
- name: Update release with files
id: create_version_release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: './system.json, ./Essence20.zip'
body: ${{ github.event.release.body }}
draft: ${{ github.event.release.unpublished }}
name: ${{ github.event.release.name }}
prerelease: ${{ github.event.release.prerelease }}
tag: ${{ github.event.release.tag_name }}

- run: echo "🍏 This job's status is ${{ job.status }}."
8 changes: 4 additions & 4 deletions module/sheet-handlers/attachment-handler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export async function createItemCopies(items, owner, type, parentItem, lastProce
const newItem = await Item.create(itemToCreate, { parent: owner });

if (["upgrade", "weaponEffect"].includes(newItem.type) && ["weapon", "armor"].includes(parentItem.type)) {
const newKey = setEntryAndAddItem(newItem, parentItem);
const newKey = await setEntryAndAddItem(newItem, parentItem);
newItem.setFlag('essence20', 'collectionId', newKey);

const deleteString = `system.items.-=${key}`;
Expand Down Expand Up @@ -130,7 +130,7 @@ async function _attachItem(targetItem, dropFunc) {
const newattachedItem = newattachedItemList[0];
newattachedItem.setFlag('essence20', 'parentId', targetItem._id);
if (targetItem) {
const key = setEntryAndAddItem(newattachedItem, targetItem);
const key = await setEntryAndAddItem(newattachedItem, targetItem);
newattachedItem.setFlag('essence20', 'collectionId', key);
}
}
Expand All @@ -139,7 +139,7 @@ async function _attachItem(targetItem, dropFunc) {
* Handles setting the value of the entry variable and calling the creating function
* @param {Item} droppedItem The Item that is being attached to the other Item
* @param {Item} atttachedItem The Item receiving the dropped Item
* @return {String} The key generated for the dropped item
* @return {Promise<String>} The key generated for the dropped item
*/
export async function setEntryAndAddItem(droppedItem, targetItem) {
const entry = {
Expand Down Expand Up @@ -237,7 +237,7 @@ export async function setEntryAndAddItem(droppedItem, targetItem) {
* @param {Item} droppedItem The Item that was dropped
* @param {Item} targetItem The Item that was dropped onto
* @param {Object} entry The entry for the Item being added
* @return {String} The key generated for the dropped Item
* @return {Promise<String>} The key generated for the dropped Item
*/
export async function _addItemIfUnique(droppedItem, targetItem, entry) {
const items = targetItem.system.items;
Expand Down
30 changes: 30 additions & 0 deletions module/sheets/actor-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
onItemDelete,
onInlineEdit,
} from "../sheet-handlers/listener-item-handler.mjs";
import { getItemsOfType } from "../helpers/utils.mjs";

export class Essence20ActorSheet extends ActorSheet {
constructor(...args) {
Expand Down Expand Up @@ -65,6 +66,9 @@ export class Essence20ActorSheet extends ActorSheet {
this._prepareDisplayedNpcSkills(context);
}

// Prepare WeaponEffect Skill List
this._prepareWeaponEffectSkills(actorData, context);

// Prepare number of actions
if (['giJoe', 'npc', 'pony', 'powerRanger', 'transformer'].includes(actorData.type)) {
context.numActions = getNumActions(this.actor);
Expand Down Expand Up @@ -139,6 +143,32 @@ export class Essence20ActorSheet extends ActorSheet {

context.displayedNpcSkills = displayedNpcSkills;
}
/**
* Prepare skill list to be used or weaponEffects on an actor
* @param {Object} actorData The acor data converted to an object
* @param {Object} context The actor data to prepare.
*/
_prepareWeaponEffectSkills(actorData, context) {
let hasSkillDie = false;
let skillDieName = null;
const items = getItemsOfType ("role", actorData.items);
if (items.length && items[0].system.skillDie.isUsed) {
hasSkillDie = true;
skillDieName = items[0].system.skillDie.name;
}

let weaponEffectSkills = {};
for (const skill of Object.keys(actorData.system.skills)) {
weaponEffectSkills[skill] = {
key: skill,
label: skill == 'roleSkillDie' && hasSkillDie
? skillDieName
: game.i18n.localize(CONFIG.E20.skills[skill]),
};
}

context.weaponEffectSkills = weaponEffectSkills;
}

/**
* Organize and classify Items for Character sheets.
Expand Down
2 changes: 1 addition & 1 deletion system.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Essence20",
"description": "The Essence20 system for FoundryVTT!",
"version": "4.3.3",
"version": "4.3.4",
"esmodules": [
"module/essence20.mjs",
"module/story-points-tracker.js",
Expand Down
14 changes: 1 addition & 13 deletions templates/actor/parts/items/weapon/container.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,7 @@
{{item.name}}
</div>
<select class="inline-edit" data-field="system.classification.skill" data-parent-field="system.items.{{@key}}.classification.skill" name="item.classification.skill">
{{#select item.classification.skill}}
{{#each @root.actor.system.skills as |skill skillType|}}
{{#ifEquals skillType "roleSkillDie"}}
{{#if @root.role.system.skillDie.isUsed}}
<option value="{{skillType}}">{{@root.role.system.skillDie.name}}</option>
{{/if}}
{{else if skill.displayName}}
<option value="{{skillType}}">{{skill.displayName}}</option>
{{else}}
<option value="{{skillType}}">{{localize (lookup @root.config.skills skillType)}}</option>
{{/ifEquals}}
{{/each}}
{{/select}}
{{selectOptions @root.weaponEffectSkills selected=item.classification.skill valueAttr="key" labelAttr="label" localize=true}}
</select>

<div class="flexrow" style="flex-wrap: nowrap; gap: 2px;">
Expand Down
8 changes: 4 additions & 4 deletions templates/dialog/essence-select.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{{#> "systems/essence20/templates/item/parts/sheet-field.hbs" label='E20.EssenceStrength'}}
{{#*inline "item-field-inputs"}}
<select class="item-field-inputs" name="strength" id="strength">
{{selectOptions choices nameAttr="key" labelAttr="label"}}
{{selectOptions choices valueAttr="key" labelAttr="label"}}
</select>
{{/inline}}
{{/"systems/essence20/templates/item/parts/sheet-field.hbs"}}
Expand All @@ -14,7 +14,7 @@
{{#> "systems/essence20/templates/item/parts/sheet-field.hbs" label='E20.EssenceSpeed'}}
{{#*inline "item-field-inputs"}}
<select class="item-field-inputs" name="speed" id="speed">
{{selectOptions choices nameAttr="key" labelAttr="label"}}
{{selectOptions choices valueAttr="key" labelAttr="label"}}
</select>
{{/inline}}
{{/"systems/essence20/templates/item/parts/sheet-field.hbs"}}
Expand All @@ -23,7 +23,7 @@
{{#> "systems/essence20/templates/item/parts/sheet-field.hbs" label='E20.EssenceSmarts'}}
{{#*inline "item-field-inputs"}}
<select class="item-field-inputs" name="smarts" id="smarts">
{{selectOptions choices nameAttr="key" labelAttr="label"}}
{{selectOptions choices valueAttr="key" labelAttr="label"}}
</select>
{{/inline}}
{{/"systems/essence20/templates/item/parts/sheet-field.hbs"}}
Expand All @@ -32,7 +32,7 @@
{{#> "systems/essence20/templates/item/parts/sheet-field.hbs" label='E20.EssenceSocial'}}
{{#*inline "item-field-inputs"}}
<select class="item-field-inputs" name="social" id="social">
{{selectOptions choices nameAttr="key" labelAttr="label"}}
{{selectOptions choices valueAttr="key" labelAttr="label"}}
</select>
{{/inline}}
{{/"systems/essence20/templates/item/parts/sheet-field.hbs"}}
Expand Down

0 comments on commit 8c65dce

Please sign in to comment.