Skip to content

Commit bdd3dbb

Browse files
committed
fix: working item sheets
1 parent a2cbf7c commit bdd3dbb

File tree

7 files changed

+78
-7
lines changed

7 files changed

+78
-7
lines changed

src/lang/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@
216216
"OSE.items.Armors": "Armors",
217217
"OSE.items.Weight": "Wgt.",
218218
"OSE.items.WeightLong": "Weight",
219-
"OSE.items.ItemBasedEncumberance": "Enc.",
220-
"OSE.items.ItemBasedEncumberanceLong": "Item-Based Encumbrance",
219+
"OSE.items.ItemBasedEncumbrance": "Enc.",
220+
"OSE.items.ItemBasedEncumbranceLong": "Item-Based Encumbrance",
221221
"OSE.items.Qualities": "Qualities",
222222
"OSE.items.Notes": "Notes",
223223
"OSE.items.Cost": "Cost",

src/module/item/entity.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ export default class OseItem extends Item {
3131
if (source?.img === "" && source.type) {
3232
source.img = this.defaultIcons(source.type);
3333
}
34+
if (source?.system?.itemslots === undefined) {
35+
if (
36+
source?.system?.tags.some((tag) => tag.value === "Two-handed") &&
37+
source.type === "weapon"
38+
)
39+
source.system.itemslots = 2;
40+
if (source?.system?.type === "heavy" && source.type === "armor")
41+
source.system.itemslots = 2;
42+
}
43+
3444
return source;
3545
}
3646

src/module/item/item-sheet.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ export default class OseItemSheet extends ItemSheet {
4545
async getData() {
4646
const { data } = super.getData();
4747
data.editable = this.document.sheet.isEditable;
48-
data.config = CONFIG.OSE;
48+
data.config = {
49+
...CONFIG.OSE,
50+
encumbrance: game.settings.get(game.system.id, "encumbranceOption"),
51+
};
4952
data.enriched = {
5053
description: await TextEditor.enrichHTML(
5154
this.item.system?.description || "",

src/templates/items/armor-sheet.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,21 @@ <h1 class="charname">
7474
/>
7575
</div>
7676
</div>
77+
{{#unless (eq @root.config.encumbrance 'itembased')}}
7778
<div class="form-group">
78-
<label>{{root.parent.system.encumbrance.variant}}{{#unless (eq @root.parent.system.encumbrance.variant 'itembased')}}{{localize 'OSE.items.Weight'}}{{else}}{{localize 'OSE.items.ItemBasedEncumbrance'}}{{/unless}}</label>
79+
<label>{{localize 'OSE.items.Weight'}}</label>
80+
<div class="form-fields">
81+
<input
82+
type="text"
83+
name="system.weight"
84+
value="{{system.weight}}"
85+
data-dtype="Number"
86+
/>
87+
</div>
88+
</div>
89+
{{else}}
90+
<div class="form-group">
91+
<label>{{localize 'OSE.items.ItemBasedEncumbrance'}}</label>
7992
<div class="form-fields">
8093
<input
8194
type="text"
@@ -85,6 +98,7 @@ <h1 class="charname">
8598
/>
8699
</div>
87100
</div>
101+
{{/unless}}
88102
</div>
89103
<div class="description">
90104
{{editor enriched.description target="system.description"

src/templates/items/container-sheet.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ <h1 class="charname">
2121
/>
2222
</div>
2323
</div>
24+
{{#unless (eq @root.config.encumbrance 'itembased')}}
2425
<div class="form-group">
25-
<label>{{#unless (eq @root.system.encumbrance.variant 'itembased')}}{{localize 'OSE.items.Weight'}}{{else}}{{localize 'OSE.items.ItemBasedEncumbrance'}}{{/unless}}</label>
26+
<label>{{localize 'OSE.items.Weight'}}</label>
2627
<div class="form-fields">
2728
<input
2829
type="text"
@@ -32,6 +33,19 @@ <h1 class="charname">
3233
/>
3334
</div>
3435
</div>
36+
{{else}}
37+
<div class="form-group">
38+
<label>{{localize 'OSE.items.ItemBasedEncumbrance'}}</label>
39+
<div class="form-fields">
40+
<input
41+
type="text"
42+
name="system.itemslots"
43+
value="{{system.itemslots}}"
44+
data-dtype="Number"
45+
/>
46+
</div>
47+
</div>
48+
{{/unless}}
3549
</div>
3650
<div class="description weapon-editor">
3751
{{editor enriched.description

src/templates/items/item-sheet.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ <h1 class="charname">
6868
/>
6969
</div>
7070
</div>
71+
{{#unless (eq @root.config.encumbrance 'itembased')}}
7172
<div class="form-group">
72-
<label>{{#unless (eq @root.system.encumbrance.variant 'itembased')}}{{localize 'OSE.items.Weight'}}{{else}}{{localize 'OSE.items.ItemBasedEncumbrance'}}{{/unless}}</label>
73+
<label>{{localize 'OSE.items.Weight'}}</label>
7374
<div class="form-fields">
7475
<input
7576
type="text"
@@ -79,6 +80,19 @@ <h1 class="charname">
7980
/>
8081
</div>
8182
</div>
83+
{{else}}
84+
<div class="form-group">
85+
<label>{{localize 'OSE.items.ItemBasedEncumbrance'}}</label>
86+
<div class="form-fields">
87+
<input
88+
type="text"
89+
name="system.itemslots"
90+
value="{{system.itemslots}}"
91+
data-dtype="Number"
92+
/>
93+
</div>
94+
</div>
95+
{{/unless}}
8296
</div>
8397
<div class="description weapon-editor">
8498
{{editor enriched.description

src/templates/items/weapon-sheet.html

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ <h1 class="charname">
2020
/>
2121
</div>
2222
</div>
23+
{{#unless (eq @root.config.encumbrance 'itembased')}}
2324
<div class="form-group">
24-
<label title="{{#unless (eq @root.system.encumbrance.variant 'itembased')}}{{localize 'OSE.items.WeightLong'}}{{else}}{{localize 'OSE.items.ItemBasedEncumbranceLong'}}{{/unless}}"
25+
<label title="{{localize 'OSE.items.WeightLong'}}"
2526
><i class="fas fa-weight-hanging"></i
2627
></label>
2728
<div class="form-fields">
@@ -33,6 +34,21 @@ <h1 class="charname">
3334
/>
3435
</div>
3536
</div>
37+
{{else}}
38+
<div class="form-group">
39+
<label title="{{localize 'OSE.items.ItemBasedEncumbranceLong'}}"
40+
><i class="fas fa-weight-hanging"></i
41+
></label>
42+
<div class="form-fields">
43+
<input
44+
type="text"
45+
name="system.itemslots"
46+
value="{{system.itemslots}}"
47+
data-dtype="Number"
48+
/>
49+
</div>
50+
</div>
51+
{{/unless}}
3652
</div>
3753
</div>
3854
<ol class="tag-list">

0 commit comments

Comments
 (0)