Skip to content

Commit

Permalink
Merge pull request #20 from AngryBeaver/pf2e
Browse files Browse the repository at this point in the history
Pf2e
  • Loading branch information
AngryBeaver authored Feb 4, 2023
2 parents 3e466cc + 006eda2 commit d4308a2
Show file tree
Hide file tree
Showing 30 changed files with 717 additions and 897 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ With this module you can create recipes to craft items. E.g. a bunch of mushroom
![Foundry System](https://img.shields.io/endpoint?url=https%3A%2F%2Ffoundryshields.com%2Fsystem%3FnameType%3Draw%26showVersion%3D1%26style%3Dflat%26url%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2FAngryBeaver%2Fbeavers-crafting%2Fmain%2Fmodule.json)
![Download Count](https://img.shields.io/github/downloads/AngryBeaver/beavers-crafting/total?color=bright-green)

<!> breaking change 1.x -> 2.x see [Changelog](https://github.com/AngryBeaver/beavers-crafting/blob/main/changelog.md)
This module is now system independent.
⚠️This module now depends on other modules to work, you need to enable them ⚠️ [Changelog](https://github.com/AngryBeaver/beavers-crafting/blob/main/changelog.md)

## Features
![img.gif](pictures/video.gif)
Expand Down
15 changes: 15 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# Changelog
## 2.3.x feature system independent
⚠️This module now depends on other modules to work, you need to enable them ⚠️

This module can now run on multiple systems.
It is implemented against [Beaver's System Interface](https://github.com/AngryBeaver/beavers-system-interface),
so this module does not have any code to run on your system.

In order to make this module work on your system, all you need is a tiny bsa-x implementation that maps the interface to your system.
You can write your own or use [existing once](https://github.com/AngryBeaver/beavers-system-interface/wiki/BSA-x-links) others have written.
I start of providing one for [dnd5e](https://github.com/AngryBeaver/bsa-dnd5e) and one for [pf2e](https://github.com/AngryBeaver/bsa-pf2e).

Those adaptions are pretty simple and small but needs some insights about the system.
So my hope is those playing in a system knowing it can write their own adaptions without me who has no idea about that system.
If not you at least now have this module in pf2e as well.

## 2.2.x feature: Time To Craft
### 2.2.2 workaround for ready set roll
This fix should work for the current version of ready set roll 1.3.14.
Expand Down
89 changes: 76 additions & 13 deletions css/crafting.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
}

.beavers-crafting .recipe .header{
height: 28px;
line-height:20px;
margin: 5px 0;
align-items: center;
background: rgba(0, 0, 0, 0.05);
border: 2px groove #eeede0;
font-weight: bold;
color: #7a7971;
font-weight: 700;
font-size: 16px;
Expand All @@ -34,11 +33,6 @@
flex: 0 0 56px;
}

.beavers-crafting .recipe .action{
flex: 0 0 30px;
border-left: 1px solid #c9c7b8;
padding-left:5px;
}
.beavers-crafting .recipe input[type="checkbox"]{
flex:0 0 15px;
width:15px;
Expand All @@ -63,6 +57,8 @@
/* Border */
border: 1px dashed #ffffff;
border-radius: 0.25rem;
font-family: 'Gelasio';
color:white;
}

.beavers-crafting.chat .header {
Expand Down Expand Up @@ -98,12 +94,7 @@
.beavers-crafting.chat .header .fas{
line-height:24px;
}
.beavers-crafting .item .fa-times{
color:#b94a48
}
.beavers-crafting .item .fa-check{
color:#468847
}

.beavers-crafting.chat .item-image{
height:30px;
flex:0 0 30px;
Expand Down Expand Up @@ -253,6 +244,13 @@
height:20px;
}

.beavers-crafting .recipe .crafting-item-img{
background-size: contain;
margin: 5px;
width:30px;
height:30px;
}

.beavers-crafting .processing{
background-image: repeating-linear-gradient(
-45deg,
Expand All @@ -276,4 +274,69 @@
@keyframes beavers-crafting-diagonal {
0% {background-position: 0% 50%}
100% {background-position: 95% 50%}
}

.beavers-crafting .flexrow {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
}

.beavers-crafting .item .item-image {
height: 26px;
flex:0 26px;
border-radius: 2px;
background-size: contain;
margin:2px;
}
.beavers-crafting .item {
height: 30px;
}
.beavers-crafting .item .item-name {
line-height: 30px;
font-size: small;
font-style: italic;
}

.beavers-crafting .item .action, .beavers-crafting .header .action{
flex: 0 0 30px;
border-left: 1px solid #c9c7b8;
justify-content: right;
}
.beavers-crafting .item .action a, .beavers-crafting .header .action a{
flex: 0;
margin: auto;
}
.beavers-crafting select {
margin: auto;
}

.beavers-crafting.actor-tab .header{
background-color: dimgrey;
color: white;
text-shadow: 1px 1px var(--color-shadow-dark);
font-weight: bold;
flex: 30px;
line-height: 30px;
text-align: center;
}

.beavers-crafting.actor-tab .scale{
flex:1 0 100px;
width:100px;
}

.beavers-crafting.actor-tab .status{
flex:0 0 80px
}
.beavers-crafting.actor-tab .option{
flex:0 0 30px;
}

.beavers-crafting .fa-times{
color:#b94a48
}
.beavers-crafting .fa-check{
color:#468847
}
1 change: 0 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"table": {
"name": "Name",
"status": "Status",
"add": "+ Add",
"input": "Resources",
"output": "Results"
}
Expand Down
2 changes: 1 addition & 1 deletion macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,6 @@ if(!result.hasError()){
you can transform a real Item into a Component by using:
````javascript
const entity // real item e.g. fromUuid(uuid)
const component = game['beavers-crafting'].Component.fromEntity(entity);
const component = game["beavers-system-interface"].system.createComponent(entity);
````

34 changes: 27 additions & 7 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Beaver's Crafting Module",
"description": "A Crafting Module for DnD",
"id": "beavers-crafting",
"version": "2.2.2",
"version": "2.3.0",
"authors": [
{
"name": "angryBeaver",
Expand All @@ -29,6 +29,7 @@
"name": "ingredients",
"path": "./packs/ingredients.db",
"module": "beavers-crafting",
"system": "dnd5e",
"type": "Item",
"private": false
}
Expand All @@ -37,13 +38,32 @@
"manifest": "https://github.com/AngryBeaver/beavers-crafting/releases/latest/download/module.json",
"download": "https://github.com/AngryBeaver/beavers-crafting/releases/latest/download/beavers-crafting.zip",
"relationships": {
"systems": [{
"id": "dnd5e",
"type": "system",
"compatibility": {
"verified": "2.0.0"
"requires": [
{
"id": "beavers-system-interface",
"type": "module",
"manifest": "https://github.com/AngryBeaver/beavers-system-interface/releases/latest/download/module.json",
"compatibility": {
"verified": "1.0.5"
}
},
{
"id": "bsa-dnd5e",
"type": "module",
"manifest": "https://github.com/AngryBeaver/bsa-dnd5e/releases/latest/download/module.json",
"compatibility": {
"verified": "1.0.0"
}
},
{
"id": "bsa-pf2e",
"type": "module",
"manifest": "https://github.com/AngryBeaver/bsa-pf2e/releases/latest/download/module.json",
"compatibility": {
"verified": "1.0.0"
}
}
}]
]
},
"compatibility": {
"minimum": "10",
Expand Down
23 changes: 21 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "beavers-crafting",
"title": "Beaver's Crafting",
"version": "2.2.2",
"version": "2.3.0",
"description": "Crafting",
"devDir": "C:\\Users\\Riess\\AppData\\Local\\FoundryVTT\\Data\\modules",
"main": "src/main.js",
Expand All @@ -23,6 +23,7 @@
"printWidth": 120
},
"devDependencies": {
"beavers-system-interface": "^1.0.6",
"@ethaks/fvtt-quench": "^0.6.0",
"@league-of-foundry-developers/foundry-vtt-types": "^0.8.8-9",
"@types/jest": "^27.4.1",
Expand Down
15 changes: 10 additions & 5 deletions src/AnyOf.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {Settings} from "./Settings.js";
import {RecipeCompendium} from "./apps/RecipeCompendium.js";
import {Component} from "./Recipe.js";

export class AnyOf {
macro;
Expand All @@ -10,7 +9,12 @@ export class AnyOf {

static isAnyOf(item) {
// @ts-ignore
return (item?.type === 'loot' && item?.system?.source === Settings.ANYOF_SUBTYPE);
return (
item?.type === beaversSystemInterface.configLootItemType && (
item?.system?.source === Settings.ANYOF_SUBTYPE ||
item?.flags["beavers-crafting"]?.subtype === Settings.ANYOF_SUBTYPE
)
);
}

constructor(item) {
Expand Down Expand Up @@ -57,12 +61,13 @@ export class AnyOf {
const resultList:ComponentData[] = [];
for(const item of itemList){
const result = await this.executeMacro(item);
const componentItem = beaversSystemInterface.componentFromEntity(item);
if(result.value){
const same = resultList.filter(component => RecipeCompendium.isSame(item,component))
const same = resultList.filter(component => componentItem.isSame(component))
if(same.length > 0){
same[0].quantity = same[0].quantity + item.system?.quantity;
same[0].quantity = same[0].quantity + componentItem.quantity;
}else{
resultList.push(new Component(item,item.uuid,"Item"));
resultList.push(componentItem);
}
}
}
Expand Down
Loading

0 comments on commit d4308a2

Please sign in to comment.