DFreds / dfreds-pocket-change

A FoundryVTT module that automatically adds money to NPC character sheets when dropped on the canvas.
MIT License
9 stars 7 forks source link

Damaged items macro not working #21

Closed bugbeersandflagons closed 3 years ago

bugbeersandflagons commented 3 years ago

I am using the custom damage macro, which I've just reimported from the compendium, and running version 3.1.2 of the module. Using the damaged items settings under module settings, and generating loot from the character sheet, I still never see damaged items (even if set to 100% chance items will be damaged).

Similarly, if I use the macro and set the values to a high chance of damaged items, converting to lootable just puts the full value, undamaged items on the sheet for players to loot.

I am also running Monk's Token Bar, and Monk's Little Details - so not sure if there's some clash there since it also has a convert to loot function (which I've currently got disabled).

macro loot sheet

bugbeersandflagons commented 3 years ago

Should have noted:

Foundry version - 0.8.9 5e system version - 1.4.2

DFreds commented 3 years ago

Hm, thanks for bringing this up. I highly doubt there is any clashing going on with any other module. I'll try to see if I can reproduce this. Just to be clear, you're converting to loot only with the custom macro and not the button on the character sheet?

What happens if you go into the pocket change settings and set the damaged item values really high there and use the button on the character sheet to convert it to a lootable?

DFreds commented 3 years ago

I'm unable to reproduce this issue. Best bet is to copy/paste the entire macro you're running here so I can see if I see anything funky. But otherwise, it seems to be working exactly as expected. You could also try disabling all other modules to see if something is conflicting. Feel free to get back to me, but I'm closing this for now.

bugbeersandflagons commented 3 years ago

// This is the percent chance that a Common item will be damaged when a token is converted to loot. A damaged item has its value reduced and appends (Damaged) to the name. Set this to 0 if you want to disable damaged items. const chanceOfDamagedItems = 1.0;

// This multiplies the price of a damaged item by the given number, lowering its value. const damagedItemsMultiplier = 0.1;

// If set to true, this will remove items that are damaged from tokens that are converted to loot. const removeDamagedItems = false;

const macroSupport = new game.dfreds.MacroSupport(); macroSupport.convertSelectedTokensToLoot( chanceOfDamagedItems, damagedItemsMultiplier, removeDamagedItems );

Above is the macro. Changing the settings in the options and using the button on the character sheet has the same result - no damaged items. I'll try running this with no other modules as you suggest

bugbeersandflagons commented 3 years ago

Right... so this seems to depend on the compendium I've imported from. I have a large compendium of actors I tend to draw from, and the macro does not work on those. However, importing directly from the SRD compendium, the macro works.

I'm fairly satisfied this is an issue with my actors, and not with your module! I'll update here if I figure anything else out

UPDATE - reimporting actors from the compendium seems to have fixed the issue. I had issues migrating my compendia to the latest 5e system, I suspect that to be the root cause of the issue

DFreds commented 3 years ago

Ah okay. Yeah, something must've gone wrong with the migration. Thanks for letting me know!

asciodev commented 3 years ago

I am not getting any items converted to "Damaged" even when importing directly from the SRD compendium. Notably, when I import any monster from the SRD and check its features tab, the items have no set rarity value, for some reason. As a result, the check for "Common" items does not work on SRD compendium monsters.

This is definitely an issue with the SRD compendium and not this module. However, said issue completely prevents this feature (damaged items) of this module from working. I am not sure how to fix this.

DFreds commented 3 years ago

Well, features shouldn't have a rarity... only inventory items. Is that what you meant?