Skip to content

Commit 2c8e85b

Browse files
committed
✨ Starting Gear configuration: each grid now creates their own equip type
Fix #113
1 parent 3634837 commit 2c8e85b

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

Diff for: model/tab/player-gear.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<b class="name">{{localize "GEAR.NAME"}}</b>
88
<b class="bonus">{{localize "GEAR.BONUS"}}</b>
99
<b class="effect">{{localize "GEAR.EFFECT"}}</b>
10-
<a class="button item-create" title='{{localize "UI.ADD"}}' data-type="gear"><i class="fas fa-plus"></i></a>
10+
<a class="button item-create" title='{{localize "UI.ADD"}}' data-type="gear" data-starting="true"><i class="fas fa-plus"></i></a>
1111
</div>
1212
<div class="scrollable">
1313
{{#each items as |item|}}
@@ -38,7 +38,7 @@
3838
<b class="name">{{localize "GEAR.NAME"}}</b>
3939
<b class="bonus">{{localize "GEAR.BONUS"}}</b>
4040
<b class="effect">{{localize "GEAR.EFFECT"}}</b>
41-
<a class="button item-create" title='{{localize "UI.ADD"}}' data-type="gear"><i class="fas fa-plus"></i></a>
41+
<a class="button item-create" title='{{localize "UI.ADD"}}' data-type="gear" data-starting=""><i class="fas fa-plus"></i></a>
4242
</div>
4343
<div class="scrollable">
4444
{{#each items as |item|}}

Diff for: script/sheet/player.js

+23
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,29 @@ export class PlayerCharacterSheet extends VaesenActorSheet {
236236
});
237237
}
238238

239+
onItemCreate(event) {
240+
event.preventDefault();
241+
let header = event.currentTarget;
242+
let data = duplicate(header.dataset);
243+
244+
if (data.type != "gear" && data.type != "weapon")
245+
{
246+
super.onItemCreate(event);
247+
return;
248+
}
249+
250+
data["name"] = `New ${data.type.capitalize()}`;
251+
if (data.type == "weapon") {
252+
data["system.starting"] = this.actor.system.starting;
253+
}
254+
else if (data.type == "gear") {
255+
data["system.starting"] = data.starting ? true : false;
256+
delete data.starting;
257+
}
258+
console.log("CUSSA", data);
259+
this.actor.createEmbeddedDocuments("Item", [data]);
260+
}
261+
239262
computeItems(data) {
240263
for (let item of Object.values(data.items)) {
241264
item.isCriticalInjury = item.type === "criticalInjury";

0 commit comments

Comments
 (0)