Comments (7)
This is probably on my side
from foundry-vtt-tidy-5e-sheets.
Quick update: We found an approach that might work really well, and p4535992 is trying it out.
from foundry-vtt-tidy-5e-sheets.
This is probably on my side
Let me know if I can help. If I'm missing anything in the API, I can add it in.
from foundry-vtt-tidy-5e-sheets.
Still in a waiting pattern for this.
Adding repo for quicker cross-referencing: https://github.com/p4535992/foundryvtt-lazymoney-dnd5e
from foundry-vtt-tidy-5e-sheets.
Cross-post: p4535992/foundryvtt-lazymoney-dnd5e#9
from foundry-vtt-tidy-5e-sheets.
Nothing to much problems with others modules using the hooks. i tried the following code, but the preUpdateActor
, but it seem to not work well with other modules, and also pass to me the number no the string.
Hooks.on("preUpdateActor", (actor, update, ...rest) => {
if (!game.settings.get(CONSTANTS.MODULE_ID, "enable")) {
return;
}
if (game.system.id === "dnd5e") {
const currency = foundry.utils.getProperty(update, API.ACTOR_CURRENCY_ATTRIBUTE) || undefined;
if (currency) {
const currencyActor = foundry.utils.getProperty(actor, API.ACTOR_CURRENCY_ATTRIBUTE) || {};
Object.entries(currency).forEach(([key, value]) => {
// Also i must do this because the update object has number not string
const currencyData = foundry.utils.getProperty(currency, key);
const currencyActorData = foundry.utils.getProperty(currencyActor, key);
let currencyDataS = String(currencyData);
if(currencyData < currencyActorData) {
currencyDataS = "-"+(currencyActorData-currencyData);
}
else if(currencyData > currencyActorData) {
currencyDataS = "+"+(currencyData-currencyActorData);
}
else if(currencyData === currencyActorData) {
currencyDataS = "="+(currencyData);
}
LazyMoneyHelpers.manageCurrencySync(actor, currencyDataS, key);
});
foundry.utils.setProperty(update, API.ACTOR_CURRENCY_ATTRIBUTE, undefined);
}
}
else {
Logger.warn(`The system '${game.system.id }' is not supported open a issue on the project`, false);
}
// TODO ADD OTHER SYSTEM
});
the best solution is some html selector i can use on the tidysheet5e like i'm doing on the standard one with this code:
export function applyLazyMoney(app, html, actorData, itemSelector) {
if (!game.settings.get(CONSTANTS.MODULE_ID, "enable")) {
return;
}
html.find(itemSelector).off("change"); // Stop default sheet behaviour
html.find(itemSelector).change(
{
app: app,
data: actorData,
},
_onChangeCurrency, // my code
);
}
function _onChangeCurrency(ev) {
const input = ev.target;
const actor = ev.data.app.actor;
const sheet = ev.data.app.options;
const denom = input.name.split(".")[2];
const value = input.value;
// DO SOMETHING
}
from foundry-vtt-tidy-5e-sheets.
I'll see what I can do to make the necessary changes to allow lazy money to hook in and control the currency inputs. I should be able to provide something that will work for your use case, but because of the way svelte is with event handling, I will need a little extra time to figure out an approach. Directly calling off()
via jquery will typically not remove svelte's event wiring, to my knowledge. Forien and I learned this with Item Macro.
I'll be in touch when I've got something released for you to test.
Thanks for posting the sample code and recommendations. I hope to help get this resolved soon.
Also, for everyone else reading, I apologize for the wait. Tidy development has been going nonstop, especially with dnd5e 3.x having recently come out.
from foundry-vtt-tidy-5e-sheets.
Related Issues (20)
- `calculateDeterministicBonus` doesn't always handle non-deterministic tokens correctly. HOT 3
- dnd5e 3.3.x: Charge/Uncharge Context Menu Options
- dnd5e 3.3.x: Migration Needed - Bonds, Ideals, Flaws for all creatures
- dnd5e 3.3.x: Migration Needed - Spell Source
- feat: Inline Container Capacity on Table Row
- dnd5e 3.3.x: NPC Rest, fully on system now
- dnd5e 3.3.x: Review Spellbook Calculations HOT 1
- feat: Tidy Tool - Bulk Assign Source Classes for Actor
- dnd5e: Add conditions to NPC sheet, Effects tab
- dnd5e: Migration needed, NPC exhaustion
- bug: New Feature breaks sheet when enchantment is selected
- chore: Use official EnchantmentConfig application
- question: Research if Polymorphed Tidy Sheets Experience can be Improved
- Compatability with Custom DnD5e encumbrance adjustments HOT 7
- Custom Exhaustion Rules do not persist after page reload. HOT 1
- feat: Clicking Add Class / Background / Race should open Compendium Browser HOT 1
- bug: Tidy allows adding multiple races, and this is not supported
- style: Dropdown sizes in Midi-QoL tab
- feat: Feature Type Column on Feature item tables
- feat: Misc Sheet Header Improvements - Quick View Portrait, ability CSS QoL, Mod/Save Label Visibility
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from foundry-vtt-tidy-5e-sheets.