Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions betternpcsheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export class BetterNPCActor5eSheet extends ActorSheet5eNPC {
html.find('.type-list a').click(ev => {
let targetList = ev.target.dataset.value
let itemId = $(ev.target).parents('.item').attr('data-item-id');
let item = this.actor.getOwnedItem(itemId);
let item = this.actor.items.get(itemId);
item.update({ "flags.adnd5e.itemInfo.type": targetList });
});

Expand All @@ -145,7 +145,7 @@ export class BetterNPCActor5eSheet extends ActorSheet5eNPC {
// apply saved item detail display state
this.saveState = false;
for (let element of html.find('.npc-item-name')) {
let item = this.actor.getOwnedItem($(element).parents('.item').data("item-id"));
let item = this.actor.items.get($(element).parents('.item').data("item-id"));
if (hasProperty(item, 'data.flags.betternpcsheet5e.showItemSummary') && item.data.flags.betternpcsheet5e.showItemSummary) {
$(element).trigger('click');
}
Expand Down Expand Up @@ -201,7 +201,7 @@ export class BetterNPCActor5eSheet extends ActorSheet5eNPC {
super._onItemSummary(event);
if (this.isEditable && this.saveState !== false) {
let li = $(event.currentTarget).parents(".item");
let item = this.actor.getOwnedItem(li.data("item-id"));
let item = this.actor.items.get(li.data("item-id"));
let showItemSummary = true;
if (hasProperty(item, 'data.flags.betternpcsheet5e.showItemSummary')) {
showItemSummary = !item.data.flags.betternpcsheet5e.showItemSummary;
Expand Down Expand Up @@ -435,7 +435,7 @@ export class BetterNPCActor5eSheet extends ActorSheet5eNPC {
let targetType = targetTile.length > 0 ? targetTile[0].dataset.tile : '';

if (targetType && targetType.indexOf('spell') === -1 && targetType !== typeFlag) {
let item = this.actor.getOwnedItem(data.data._id);
let item = this.actor.items.get(data.data._id);
item.update({ 'flags.adnd5e.itemInfo.type': targetType });
} else {
super._onDropItem(event, data);
Expand Down Expand Up @@ -472,7 +472,7 @@ export class BetterNPCActor5eSheet extends ActorSheet5eNPC {
if (this.actor.isToken) return;

// Get the drag source and its siblings
const source = this.actor.getOwnedItem(itemData._id);
const source = this.actor.items.get(itemData._id);
const siblings = this._getSortSiblings(source);
// Get the drop target
const dropTarget = event.target.closest(".item");
Expand All @@ -488,7 +488,7 @@ export class BetterNPCActor5eSheet extends ActorSheet5eNPC {
});

// Perform the update
return this.actor.updateEmbeddedEntity("OwnedItem", updateData);
return this.actor.updateEmbeddedDocuments("Item", updateData);
}

_getSortSiblings(source) {
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
"manifest": "https://raw.githubusercontent.com/syl3r86/BetterNPCSheet5e/master/module.json",
"download": "https://github.com/syl3r86/BetterNPCSheet5e/archive/master.zip",
"minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "0.8.6"
"compatibleCoreVersion": "9"
}
5 changes: 4 additions & 1 deletion template/npc-sheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ <h1 class="charname">
<input class="npc-textinput-small flex" name="data.attributes.ac.formula" class="acformula" type="text" placeholder="{{ localize "Formula" }}"
value="{{data.attributes.ac.formula}}" />
<span class="flex0">)</span>
{{#if editable}}
<a class="config-button show-on-edit" data-action="armor" title="Configure Armor"><i class="fas fa-cog"></i></a>
{{/if}}
</div>
<div class="flex-line">
<label>{{ localize "BNPCSheet.Initative" }}</label>
Expand Down Expand Up @@ -117,11 +120,11 @@ <h4 class="ability-name rollable">{{id}}</h4>
<label style="font-weight:bold;">{{ localize "BNPCSheet.Skills" }}</label>
{{#each data.skills as |skill s|}}
<div class="skill flex-line hidable" data-hidable-attr="{{skill.value}}" data-skill="{{s}}">
<input class='hidable-attr' type="hidden" name="data.skills.{{s}}.value" value="{{skill.value}}" data-dtype="Number" />
<a class="skill-proficiency show-on-edit " title="{{skill.hover}}">{{{skill.icon}}}</a>
<a class="skill-name rollable ">{{skill.label}}</a>
<span class="skill-mod ">{{numberFormat skill.total decimals=0 sign=true}}</span>
<span class="skill-ability ">({{skill.ability}})</span>
<input class='hidable-attr' type="hidden" name="data.skills.{{s}}.value" value="{{skill.value}}" data-dtype="Number" />
</div>
{{/each}}
</div>
Expand Down