Skip to content

Commit

Permalink
upda sheets, fix bugs, and improve repo for dev. issues #3 #2 #1
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcomac committed Jul 9, 2024
1 parent 1c524a6 commit 73703c9
Show file tree
Hide file tree
Showing 20 changed files with 341 additions and 50 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,47 @@ jobs:
artifacts: './release/system.json, ./release/system.zip'
tag: ${{ github.event.release.tag_name }}
body: ${{ github.event.release.body }}
# Publish version to foundry
- name: Get System ID
id: systemID
uses: notiz-dev/github-action-json-property@release
with:
path: "./release/system.json"
prop_path: "id"

- name: Get minimum
id: minimum
uses: notiz-dev/github-action-json-property@release
with:
path: "./release/system.json"
prop_path: "compatibility.minimum"

- name: Get verified
id: verified
uses: notiz-dev/github-action-json-property@release
with:
path: "./release/system.json"
prop_path: "compatibility.verified"

# Submit to foundry
- name: Submit package to FoundryVTT Package Release API
run: |
curl -X POST "https://api.foundryvtt.com/_api/packages/release_version/" \
-H "Content-Type: application/json" \
-H "Authorization: ${{ secrets.FOUNDRY_KEY }}" \
-d '{
"id": "${{ steps.systemID.outputs.prop }}",
"dry-run": false,
"release": {
"version": "${{ steps.get_version.outputs.version-without-v }}",
"manifest": "https://github.com/${{ github.repository }}/releases/latest/download/system.json",
"notes": "https://github.com/${{ github.repository }}/releases/tag/${{ steps.get_version.outputs.version-without-v }}",
"compatibility": {
"minimum": "${{ steps.minimum.outputs.prop }}",
"verified": "${{ steps.verified.outputs.prop }}",
"maximum": ""
}
}
}'
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
node_modules
*.zip
release/*
build/*
styles/*
build/*.js
styles/*.css
css/*
package-lock.json
Binary file added assets/default_world.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/official/system_bg.webp
Binary file not shown.
68 changes: 68 additions & 0 deletions dev.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
const fs = require('fs-extra');
const path = require('path');
const { exec } = require('child_process');

// Define os diretórios de origem e destino
const destDir = path.join(__dirname, '../');

// Lista de diretórios e arquivos a serem copiados
const itemsToCopy = [
'assets',
'build',
'lang',
'fonts',
'README.md',
'styles',
'templates',
'system.json',
'template.json'
];

// Função para executar comandos no terminal
function runCommand(command) {
return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
reject(`Erro ao executar ${command}: ${stderr}`);
} else {
console.log(`Executado ${command}: ${stdout}`);
resolve();
}
});
});
}

// Função principal para criar diretório, rodar comandos e copiar arquivos
async function createRelease() {
try {
// Executa os comandos necessários
await runCommand('npm run build-css');
await runCommand('npm run build-js');
await runCommand('npm run minify-js');
await runCommand('npm run minify-css');

// Verifica se o diretório de destino existe, se não, cria
await fs.ensureDir(destDir);

// Copia os arquivos e diretórios necessários para o diretório de destino
for (const item of itemsToCopy) {
const src = path.join(__dirname, item);
const dest = path.join(destDir, item);
// Verifique se o item de origem existe
const exists = await fs.pathExists(src);
if (exists) {
await fs.copy(src, dest);
console.log(`Copiado ${item} para ${dest}`);
} else {
console.log(`Item de origem ${src} não existe. Pulando...`);
}
}

console.log('Release criada com sucesso!');
} catch (err) {
console.error('Erro ao criar release:', err);
}
}

// Executa a função principal
createRelease();
8 changes: 8 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"Actions": {
"long": "Actions"
},
"ActionTable": {
"long": "Action Table"
},
"AllIn": {
"long": "All-In"
},
Expand Down Expand Up @@ -100,6 +103,11 @@
"Difficulty": {
"long": "Difficulty"
},
"Edit": {
"ActionTable": {
"long": "Edit Action Table"
}
},
"Effect": {},
"Exhausted": {
"long": "Exhausted"
Expand Down
8 changes: 8 additions & 0 deletions lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"Actions": {
"long": "Azioni"
},
"ActionTable": {
"long": "Tabela di Azioni"
},
"AllIn": {
"long": "Tutto o Niente"
},
Expand Down Expand Up @@ -100,6 +103,11 @@
"Difficulty": {
"long": "Difficoltà"
},
"Edit": {
"ActionTable": {
"long": "Modifica tabella azioni"
}
},
"Effect": {},
"Exhausted": {
"long": "Esaurito"
Expand Down
4 changes: 3 additions & 1 deletion module/helpers/templates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export const preloadHandlebarsTemplates = async function () {
'systems/household/templates/chat/parts/dices/faces.html',
// NPC parts
"systems/household/templates/actor/parts/npc-tab-main.hbs",
"systems/household/templates/actor/parts/npc-tab-main-right.hbs"
"systems/household/templates/actor/parts/npc-tab-main-right.hbs",
// Dialogs
"systems/household/templates/dialog/dialog-actions.hbs"
]);
};
79 changes: 78 additions & 1 deletion module/sheets/actor-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class HouseholdActorSheet extends ActorSheet {

// Prepare NPC data and items.
if (actorData.type == 'npc') {
this.position.width = 750;
this.position.width = 500;
this.position.height = 850;
this._prepareItems(context);
}
Expand Down Expand Up @@ -181,6 +181,83 @@ export class HouseholdActorSheet extends ActorSheet {
li.slideUp(200, () => this.render(false));
});


html.on('click', '.action-configuration', async (env) => {
const templateData = {
"action_1": {
"text": this.actor.system.actions.action_1,
"placeholder": game.i18n.localize('HOUSEHOLD.ActionI.long')
},
"action_2": {
"text": this.actor.system.actions.action_1,
"placeholder": game.i18n.localize('HOUSEHOLD.ActionI.long')
},
"action_3": {
"text": this.actor.system.actions.action_1,
"placeholder": game.i18n.localize('HOUSEHOLD.ActionI.long')
},
"action_4": {
"text": this.actor.system.actions.action_1,
"placeholder": game.i18n.localize('HOUSEHOLD.ActionI.long')
},
"action_5": {
"text": this.actor.system.actions.action_1,
"placeholder": game.i18n.localize('HOUSEHOLD.ActionI.long')
},
"action_6": {
"text": this.actor.system.actions.action_1,
"placeholder": game.i18n.localize('HOUSEHOLD.ActionI.long')
}
};

const dialog_action_config = await renderTemplate("systems/household/templates/dialog/dialog-actions.hbs", templateData);
foundry.applications.api.DialogV2.prompt({
window: { title: "Config Actions", icon: "fa-solid fa-gear" },
position: {width: 550},
classes: ["household-dialog"],
content: dialog_action_config,
rejectClose: false,
modal: true,
ok: {
label: "Submit",
callback: (event, button, dialog) => {
const new_value = {
"action_1": button.form.elements.action_1.value,
"action_2": button.form.elements.action_2.value,
"action_3": button.form.elements.action_3.value,
"action_4": button.form.elements.action_4.value,
"action_5": button.form.elements.action_5.value,
"action_6": button.form.elements.action_6.value
}
this.actor.update({['system.actions']: new_value});
}
}
})
/*return Dialog.wait({
title: `Configure Actions`,
content: dialog_action_config,
buttons: {
button1: {
label: "Save",
callback: (html) => {
const actions = {
"action_1": html.find("input#action-1").val(),
"action_2": html.find("input#action-2").val(),
"action_3": html.find("input#action-3").val(),
"action_4": html.find("input#action-4").val(),
"action_5": html.find("input#action-5").val(),
"action_6": html.find("input#action-6").val()
}
console.log(actions);
//this.actor.update({['system.actions']: new_value});
},
icon: `<i class="fas fa-save"></i>`
}
}
}).render(true);*/
});

html.on('click', '.npc-popup-item-edit', (ev) => {
//const element = $(ev.currentTarget).parents('.npc-popup-item-edit');;
const dataset =ev.currentTarget.dataset;
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"minify-js": "npx terser build/household.js -o build/household.min.js && npx rimraf build/household.js",
"minify-css": "npx postcss ./css/household.css > ./styles/household.min.css",
"release": "node release.cjs",
"dev": "node dev.cjs",
"build": "npm run build-css && npm run build-js",
"minify": "npm run minify-css && npm run minify-js",
"build-all": "npm run build && npm run minify"
Expand Down
Binary file modified readme/char1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified readme/opp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/scss/components/_custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,17 @@
border: none;
font-weight: bold;
text-align: center;
color: black;
}

.characteristic-description {
font-family: 'LHF_Encore', Beau Rivage, cursive;
font-size: 1.6em;
font-weight: 500;
font-weight: 100;
text-transform: capitalize;
border: none;
font-weight: bold;
text-align: center;
color: black;
}

.characteristic-title:after {
Expand Down
8 changes: 8 additions & 0 deletions src/scss/components/_sheets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,12 @@
border-left: 0px;
border-top: 0px;
border-right: 0px;
}

.roll-action:hover + .roll-action-description {
display: block;
}

.roll-action-description {
display: none;
}
39 changes: 39 additions & 0 deletions src/scss/global/_dialog.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.window-header {
flex: 0 0 30px;
overflow: hidden;
padding: 0 8px;
line-height: 30px;
border: none;
background-image: url(/systems/household/assets/sheet/header_bg.webp);
background-repeat: no-repeat;
background-size: cover;
color: #575757;
}

.window-title {
color: #000;
}

.window-content {
background: url(/systems/household/assets/sheet/sheet_bg.webp) repeat;

}

h2 {
font-family: 'LHF_Encore', Beau Rivage, cursive;
}

input[type=text] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: 3px solid #ccc;
-webkit-transition: 0.5s;
transition: 0.5s;
outline: none;
}

input[type=text]:focus {
border: 3px solid #555;
}
6 changes: 6 additions & 0 deletions src/scss/household.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
@import 'global/flex';
@import 'global/custom';

.household-dialog {
@import 'global/dialog';
@import 'components/custom';
}

/* Styles limited to household sheets */
.household {
@import 'components/forms';
Expand All @@ -36,3 +41,4 @@
.sheet.actor {
@import 'components/sheets';
}

13 changes: 12 additions & 1 deletion system.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@
"readme": "README.md",
"bugs": "https://github.com/piecesofcodecom/household/issues",
"changelog": "CHANGELOG.md",
"media": [],
"media": [
{
"type": "cover",
"loop": false,
"flags": {}
},
{
"type": "setup",
"url": "systems/household/assets/official/system_bg.webp",
"thumbnail": "systems/household/assets/default_world.jpg"
}
],
"version": "placeholder",
"compatibility": {
"minimum": 11,
Expand Down
Loading

0 comments on commit 73703c9

Please sign in to comment.