most things now working

This commit is contained in:
TheLastScrub
2021-05-01 23:06:20 -07:00
parent 9794019876
commit 086ec8483e
17 changed files with 150 additions and 156 deletions
+16 -10
View File
@@ -35,10 +35,11 @@ export class DeltaGreenActorSheet extends ActorSheet {
const data = super.getData();
// Prepare items.
if (this.actor.data.type == 'character') {
if (this.actor.data.type == 'agent') {
this._prepareCharacterItems(data);
}
//console.log(data);
//return data.data;
return data;
}
@@ -56,9 +57,6 @@ export class DeltaGreenActorSheet extends ActorSheet {
const armor = [];
const weapons = [];
// total armor rating
let armorRating = 0;
// Iterate through items, allocating to containers
// let totalWeight = 0;
for (let i of sheetData.items) {
@@ -146,14 +144,19 @@ export class DeltaGreenActorSheet extends ActorSheet {
// Update Inventory Item
html.find('.item-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item");
const item = this.actor.getOwnedItem(li.data("itemId"));
//const item = this.actor.getOwnedItem(li.data("itemId"));
const item = this.actor.items.get(li.data("itemId"));
item.sheet.render(true);
});
// Delete Inventory Item
html.find('.item-delete').click(ev => {
const li = $(ev.currentTarget).parents(".item");
this.actor.deleteOwnedItem(li.data("itemId"));
//this.actor.deleteOwnedItem(li.data("itemId"));
let options = {};
this.actor.deleteEmbeddedDocuments("Item", [li.data("itemId")], options);
li.slideUp(200, () => this.render(false));
});
@@ -165,7 +168,7 @@ export class DeltaGreenActorSheet extends ActorSheet {
html.find('.equipped-item').mousedown(this._onEquippedStatusChange.bind(this));
// Drag events for macros.
if (this.actor.owner) {
if (this.actor.isOwner) {
let handler = ev => this._onDragStart(ev);
html.find('li.item').each((i, li) => {
if (li.classList.contains("inventory-header")) return;
@@ -277,6 +280,7 @@ export class DeltaGreenActorSheet extends ActorSheet {
type: type,
data: data
};
// Remove the type from the dataset since it's in the itemData.type prop.
delete itemData.data["type"];
@@ -293,7 +297,8 @@ export class DeltaGreenActorSheet extends ActorSheet {
}
// Finally, create the item!
return this.actor.createOwnedItem(itemData);
//return this.actor.createOwnedItem(itemData);
return this.actor.createEmbeddedDocuments("Item", [itemData]);
}
/**
@@ -395,7 +400,8 @@ export class DeltaGreenActorSheet extends ActorSheet {
const dataset = element.dataset;
try{
const item = this.actor.getOwnedItem(dataset.id);
//const item = this.actor.getOwnedItem(dataset.id);
const item = this.actor.items.get(dataset.id);
var isEquipped = item.data.data.equipped;
isEquipped = !isEquipped;
item.update({data:{equipped: isEquipped}});
+6 -1
View File
@@ -14,9 +14,14 @@ export class DeltaGreenActor extends Actor {
const data = actorData.data;
const flags = actorData.flags;
//console.log('actor.js prepareData');
//console.log(this);
// Make separate methods for each Actor type (character, npc, etc.) to keep
// things organized.
if (actorData.type === 'agent') this._prepareAgentData(this);
if (actorData.type === 'agent'){
this._prepareAgentData(this);
}
}
/**