From b96aab0142e9efbdc26b337b9b7123acc865465f Mon Sep 17 00:00:00 2001 From: psitacus Date: Tue, 8 Jul 2025 23:28:46 -0600 Subject: [PATCH] remove debug logs --- module/applications/sheets/items/armor.mjs | 21 +-------------------- module/applications/sheets/items/weapon.mjs | 21 +-------------------- module/data/item/armor.mjs | 6 ------ module/data/item/weapon.mjs | 6 ------ module/documents/activeEffect.mjs | 4 ++-- 5 files changed, 4 insertions(+), 54 deletions(-) diff --git a/module/applications/sheets/items/armor.mjs b/module/applications/sheets/items/armor.mjs index ffeeffef..caa221a2 100644 --- a/module/applications/sheets/items/armor.mjs +++ b/module/applications/sheets/items/armor.mjs @@ -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)); } } diff --git a/module/applications/sheets/items/weapon.mjs b/module/applications/sheets/items/weapon.mjs index b07f377c..7d2b2bd5 100644 --- a/module/applications/sheets/items/weapon.mjs +++ b/module/applications/sheets/items/weapon.mjs @@ -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)); } } diff --git a/module/data/item/armor.mjs b/module/data/item/armor.mjs index afcac000..76e948b2 100644 --- a/module/data/item/armor.mjs +++ b/module/data/item/armor.mjs @@ -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`); } } } diff --git a/module/data/item/weapon.mjs b/module/data/item/weapon.mjs index ad8a8c48..6d3830cf 100644 --- a/module/data/item/weapon.mjs +++ b/module/data/item/weapon.mjs @@ -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`); } } } diff --git a/module/documents/activeEffect.mjs b/module/documents/activeEffect.mjs index 7e0f43ae..5c9b91a5 100644 --- a/module/documents/activeEffect.mjs +++ b/module/documents/activeEffect.mjs @@ -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);