remove debug logs

This commit is contained in:
psitacus 2025-07-08 23:28:46 -06:00
parent f78cf12f6e
commit b96aab0142
5 changed files with 4 additions and 54 deletions

View file

@ -110,8 +110,6 @@ export default class ArmorSheet extends DHBaseItemSheet {
const item = await Item.implementation.fromDropData(data);
if (!item) return;
console.log(`Dropping item ${item.name} (${item.uuid}) onto armor ${this.document.name}`);
// Get current attached UUIDs
const currentAttached = this.document.system.attached || [];
const newUUID = item.uuid;
@ -122,11 +120,7 @@ export default class ArmorSheet extends DHBaseItemSheet {
return;
}
console.log(`Current attached items:`, currentAttached);
console.log(`Adding new UUID:`, newUUID);
const updatedAttached = [...currentAttached, newUUID];
console.log(`Updating armor with attached items:`, updatedAttached);
await this.document.update({
'system.attached': updatedAttached
@ -136,8 +130,6 @@ export default class ArmorSheet extends DHBaseItemSheet {
// Both attachment-only and regular effects should be copied when attached
const actor = this.document.parent;
if (actor && item.effects.size > 0 && this.document.system.equipped) {
console.log(`Checking ${item.effects.size} effects from attached item ${item.name}`);
const effectsToCreate = [];
for (const effect of item.effects) {
// Copy ALL effects when item is attached - attachment-only flag only matters for non-attached items
@ -155,22 +147,12 @@ export default class ArmorSheet extends DHBaseItemSheet {
}
};
effectsToCreate.push(effectData);
const isAttachmentOnly = effect.flags?.daggerheart?.attachmentOnly === true;
console.log(`Effect ${effect.name} (attachment-only: ${isAttachmentOnly}) will be copied to actor`);
}
if (effectsToCreate.length > 0) {
const createdEffects = await actor.createEmbeddedDocuments('ActiveEffect', effectsToCreate);
console.log(`Created ${createdEffects.length} effects on actor from attached item`);
} else {
console.log(`No effects found on ${item.name}, no effects copied to actor`);
await actor.createEmbeddedDocuments('ActiveEffect', effectsToCreate);
}
} else if (item.effects.size > 0 && !this.document.system.equipped) {
console.log(`Armor ${this.document.name} is not equipped, attachment effects will be applied when equipped`);
}
console.log(`Armor updated successfully`);
}
/**
@ -198,7 +180,6 @@ export default class ArmorSheet extends DHBaseItemSheet {
});
if (effectsToRemove.length > 0) {
console.log(`Removing ${effectsToRemove.length} effects from actor that came from detached item ${uuid}`);
await actor.deleteEmbeddedDocuments('ActiveEffect', effectsToRemove.map(e => e.id));
}
}

View file

@ -109,8 +109,6 @@ export default class WeaponSheet extends DHBaseItemSheet {
const item = await Item.implementation.fromDropData(data);
if (!item) return;
console.log(`Dropping item ${item.name} (${item.uuid}) onto weapon ${this.document.name}`);
// Get current attached UUIDs
const currentAttached = this.document.system.attached || [];
const newUUID = item.uuid;
@ -121,11 +119,7 @@ export default class WeaponSheet extends DHBaseItemSheet {
return;
}
console.log(`Current attached items:`, currentAttached);
console.log(`Adding new UUID:`, newUUID);
const updatedAttached = [...currentAttached, newUUID];
console.log(`Updating weapon with attached items:`, updatedAttached);
await this.document.update({
'system.attached': updatedAttached
@ -135,8 +129,6 @@ export default class WeaponSheet extends DHBaseItemSheet {
// Both attachment-only and regular effects should be copied when attached
const actor = this.document.parent;
if (actor && item.effects.size > 0 && this.document.system.equipped) {
console.log(`Checking ${item.effects.size} effects from attached item ${item.name}`);
const effectsToCreate = [];
for (const effect of item.effects) {
// Copy ALL effects when item is attached - attachment-only flag only matters for non-attached items
@ -154,22 +146,12 @@ export default class WeaponSheet extends DHBaseItemSheet {
}
};
effectsToCreate.push(effectData);
const isAttachmentOnly = effect.flags?.daggerheart?.attachmentOnly === true;
console.log(`Effect ${effect.name} (attachment-only: ${isAttachmentOnly}) will be copied to actor`);
}
if (effectsToCreate.length > 0) {
const createdEffects = await actor.createEmbeddedDocuments('ActiveEffect', effectsToCreate);
console.log(`Created ${createdEffects.length} effects on actor from attached item`);
} else {
console.log(`No effects found on ${item.name}, no effects copied to actor`);
await actor.createEmbeddedDocuments('ActiveEffect', effectsToCreate);
}
} else if (item.effects.size > 0 && !this.document.system.equipped) {
console.log(`Weapon ${this.document.name} is not equipped, attachment effects will be applied when equipped`);
}
console.log(`Weapon updated successfully`);
}
/**
@ -197,7 +179,6 @@ export default class WeaponSheet extends DHBaseItemSheet {
});
if (effectsToRemove.length > 0) {
console.log(`Removing ${effectsToRemove.length} effects from actor that came from detached item ${uuid}`);
await actor.deleteEmbeddedDocuments('ActiveEffect', effectsToRemove.map(e => e.id));
}
}

View file

@ -108,8 +108,6 @@ export default class DHArmor extends BaseDataItem {
if (newEquippedStatus) {
// Armor is being equipped - add attachment effects
console.log(`Armor ${this.parent.name} being equipped, adding attachment effects`);
const effectsToCreate = [];
for (const attachedUuid of this.attached) {
const attachedItem = await fromUuid(attachedUuid);
@ -136,12 +134,9 @@ export default class DHArmor extends BaseDataItem {
if (effectsToCreate.length > 0) {
await actor.createEmbeddedDocuments('ActiveEffect', effectsToCreate);
console.log(`Created ${effectsToCreate.length} attachment effects on actor`);
}
} else {
// Armor is being unequipped - remove attachment effects
console.log(`Armor ${this.parent.name} being unequipped, removing attachment effects`);
const effectsToRemove = actor.effects.filter(effect => {
const attachmentSource = effect.flags?.daggerheart?.attachmentSource;
return attachmentSource && attachmentSource.armorUuid === this.parent.uuid;
@ -149,7 +144,6 @@ export default class DHArmor extends BaseDataItem {
if (effectsToRemove.length > 0) {
await actor.deleteEmbeddedDocuments('ActiveEffect', effectsToRemove.map(e => e.id));
console.log(`Removed ${effectsToRemove.length} attachment effects from actor`);
}
}
}

View file

@ -133,8 +133,6 @@ export default class DHWeapon extends BaseDataItem {
if (newEquippedStatus) {
// Weapon is being equipped - add attachment effects
console.log(`Weapon ${this.parent.name} being equipped, adding attachment effects`);
const effectsToCreate = [];
for (const attachedUuid of this.attached) {
const attachedItem = await fromUuid(attachedUuid);
@ -161,12 +159,9 @@ export default class DHWeapon extends BaseDataItem {
if (effectsToCreate.length > 0) {
await actor.createEmbeddedDocuments('ActiveEffect', effectsToCreate);
console.log(`Created ${effectsToCreate.length} attachment effects on actor`);
}
} else {
// Weapon is being unequipped - remove attachment effects
console.log(`Weapon ${this.parent.name} being unequipped, removing attachment effects`);
const effectsToRemove = actor.effects.filter(effect => {
const attachmentSource = effect.flags?.daggerheart?.attachmentSource;
return attachmentSource && attachmentSource.weaponUuid === this.parent.uuid;
@ -174,7 +169,6 @@ export default class DHWeapon extends BaseDataItem {
if (effectsToRemove.length > 0) {
await actor.deleteEmbeddedDocuments('ActiveEffect', effectsToRemove.map(e => e.id));
console.log(`Removed ${effectsToRemove.length} attachment effects from actor`);
}
}
}

View file

@ -38,13 +38,13 @@ export default class DhActiveEffect extends ActiveEffect {
get isAttached() {
if (!this.parent || !this.parent.parent) return false;
// Check if this item's UUID is in any actor's armor attachment lists
// Check if this item's UUID is in any actor's armor or weapon attachment lists
const actor = this.parent.parent;
if (!actor || !actor.items) return false;
try {
return actor.items.some(item => {
return item.type === 'armor' &&
return (item.type === 'armor' || item.type === 'weapon') &&
item.system?.attached &&
Array.isArray(item.system.attached) &&
item.system.attached.includes(this.parent.uuid);