dragdrop shennenegins

Right now, a user can drag a spell onto their character sheet. I store that in a 'spell' array and list it in the 'spell library'. They can prep the spell with the UI and that (for now) sets a flag which causes it to be displayed under the 'prepared spells' side as well. Ideally, I'd like a user to drag the spell from the library side to the prepped side and achieve the same thing. I don't need a solution and I haven't started trying to do this, but I'd really appreciate if someone could simply drop me a hint. A key word or function to look into to make this happen, because right now my understanding of how items get embedded into actors after dragging them onto the sheet is, "A wizard foundry did it."
No description
the key word hint is dragDrop more details are that somewhere in ActorSheet, there's a dragDrop registration which handles Item droppage. You'll want to modify that logic to see what element the item is dropped into and thus change what happens
Somehow, in spite of me looking, I managed to not find this function. *facepalm* Thanks. That should be enough for me to get into all sorts of stupid trouble!
these are the docs for DragDrop itself, but they're not super helpful: https://foundryvtt.com/api/DragDrop.html Core puts some fluff around this automatically for ActorSheet, providing these methods: _onDrop, and more interestingly _onDropItem I can't find these in the docs actually, seems they're marked Private, but a system is definitely expected to override them. @cswendrowski check me on that 'definitely' when you get a chance pretty please.
I see. I mean, that looks usable after some experimentation. Famous last words, though. I just noticed this in testing almost immediately. One of my players messed up his spell order because he instinctively wanted to drag his spells over to the 'prepped' section, so this should be a thing.
Default behaviour for drag&dropping an item on same sheet is to sort them. You may want to override that some when they aren't dropped into same section.

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
effect mini modulesI've gotten to the point where I'm confident in releasing a slurry of tiny no-config Active Effect rdamage application hooksNew 5e Hook ideas, gimme yer thoughts: `Hooks.call('Actor5e.preDamageApplied')` args: `damageAmounthook conventionsRegarding hooks, is the convention that _all_ `pre...` hooks are executed on the machine that initiaexpand arraysIs there a way to `expandObject` except for an Array?edit-owned-item-effectI've made an abomination. This hacks its way past the limitations surrounding editing effects on ownItem Pile feedbackSimple is king!effects to chat@badideasbureau is the `temporary` flag you look for in Effects to Chat a convention from somewhere 5e AEsI've been messing pretty heavily with some Active Effect assumptions and mechanisms in 5e. This is mhero creator ui feedbackI'm trying to refactor the abilities' tab on the hero creation room to accomodate Race ASIs, but I deffect mechanic searchingI need someone to check me on a null hypothesis I'm making. > There are no abilities in 5e RAW whicDialog shennaneginsTIL the button callbacks for `Dialog.prompt` and `Dialog.confirm` can be asynchronous. ```js const Advancement Hooks@kandashi @ccjmk and anyone else who is currently working on modules that would interact with the AdAPI doc topicsGive me some ideas for what areas of the foundry core API would benefit from a wiki documentation paDiscord Permission IssueOh, I think you also need a Typescript roleDevelopment-APIA new section of the Wiki was created today: `development/api` This section is dedicated to documentitem to actors scriptI have this macro for updating actors in a compendium with spells from a compendium of spells (i.e. Primary and Embedded UpdatesTIL how to update embedded documents at the same time as parent documents. ``` game.actors.getName(compendium errors upgrading to v9hmm im not entirely sure how this will work though.. because I did just a quick smell test to my modBlind Chat MessagesAnyone have good examples of creating a chat message that should only be visible to a connected GM, compendium shennaneginsTIL about `CompendiumContent.getDocuments` taking nedb queries. ``` game.packs.get('dnd5e.heroes').g