2020-12-04 20:52:04 +01:00
import { RdDItemSort } from "./item-sort.js" ;
2020-12-15 21:28:55 +01:00
import { RdDUtility } from "./rdd-utility.js" ;
2021-01-07 20:04:10 +01:00
import { RdDAlchimie } from "./rdd-alchimie.js" ;
2021-01-08 22:23:50 +01:00
import { RdDItemCompetence } from "./item-competence.js" ;
2021-04-04 18:37:16 +02:00
import { RdDHerbes } from "./rdd-herbes.js" ;
2021-10-29 09:53:35 +02:00
import { RdDGemme } from "./rdd-gemme.js" ;
2021-05-06 19:42:29 +02:00
import { HtmlUtility } from "./html-utility.js" ;
2023-06-20 23:43:24 +02:00
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js" ;
2021-11-11 02:43:38 +01:00
import { SYSTEM _RDD } from "./constants.js" ;
2021-12-05 01:50:09 +01:00
import { RdDSheetUtility } from "./rdd-sheet-utility.js" ;
2022-11-23 22:39:48 +01:00
import { SystemCompendiums } from "./settings/system-compendiums.js" ;
2022-12-03 18:29:29 +01:00
import { Misc } from "./misc.js" ;
2023-03-29 22:53:40 +02:00
import { RdDTimestamp } from "./time/rdd-timestamp.js" ;
2023-06-13 01:55:38 +02:00
import { RdDItemCompetenceCreature } from "./item-competencecreature.js" ;
2024-09-27 22:39:49 +02:00
import { ITEM _TYPES , RdDItem } from "./item.js" ;
2024-11-28 00:38:34 +01:00
import { FLEUVE _COORD , TMRUtility } from "./tmr-utility.js" ;
2020-12-04 20:52:04 +01:00
2020-05-21 21:48:20 +02:00
/ * *
2022-12-03 18:29:29 +01:00
* Extend the basic ItemSheet for RdD specific items
2020-05-21 21:48:20 +02:00
* /
2020-05-22 00:48:43 +02:00
export class RdDItemSheet extends ItemSheet {
2020-05-21 21:48:20 +02:00
2022-12-03 18:29:29 +01:00
static get ITEM _TYPE ( ) {
return undefined
}
static defaultTemplate ( type ) {
return type ?
` systems/foundryvtt-reve-de-dragon/templates/item- ${ type } -sheet.html ` :
"systems/foundryvtt-reve-de-dragon/templates/item-sheet.html" ;
}
static register ( sheetClass ) {
Items . registerSheet ( SYSTEM _RDD , sheetClass , {
label : Misc . typeName ( 'Item' , sheetClass . ITEM _TYPE ) ,
types : [ sheetClass . ITEM _TYPE ] ,
makeDefault : true
} )
}
2020-05-21 21:48:20 +02:00
/** @override */
2021-05-07 17:27:02 +02:00
static get defaultOptions ( ) {
2024-05-01 09:13:21 +02:00
return foundry . utils . mergeObject ( super . defaultOptions , {
2021-11-11 02:43:38 +01:00
classes : [ SYSTEM _RDD , "sheet" , "item" ] ,
2022-12-03 18:29:29 +01:00
template : RdDItemSheet . defaultTemplate ( RdDItemSheet . ITEM _TYPE ) ,
2021-05-07 17:27:02 +02:00
width : 550 ,
height : 550
2024-06-01 01:53:14 +02:00
} , { inplace : false } ) ;
2020-05-21 21:48:20 +02:00
}
2022-12-03 18:29:29 +01:00
/* -------------------------------------------- */
get template ( ) {
return RdDItemSheet . defaultTemplate ( this . item . type ) ;
}
get title ( ) {
2024-09-05 23:44:12 +02:00
const owner = ( this . item . parent instanceof Actor ) ? ` ( ${ this . item . parent . name } ) ` : '' ;
return ` ${ Misc . typeName ( 'Item' , this . item . type ) } : ${ this . item . name } ${ owner } ` ;
2022-12-03 18:29:29 +01:00
}
2021-12-05 16:48:18 +01:00
2020-05-21 21:48:20 +02:00
/* -------------------------------------------- */
2021-01-01 21:11:56 +01:00
_getHeaderButtons ( ) {
let buttons = super . _getHeaderButtons ( ) ;
2022-12-03 15:33:16 +01:00
if ( this . item . isInventaire ( ) && this . item . isVideOuNonConteneur ( ) ) {
2021-05-07 17:27:02 +02:00
buttons . unshift ( {
2021-12-10 01:21:01 +01:00
class : "vendre" ,
2021-05-07 17:27:02 +02:00
icon : "fas fa-comments-dollar" ,
2023-01-01 22:16:26 +01:00
onclick : ev => this . item . proposerVente ( 1 )
2021-05-07 17:27:02 +02:00
} ) ;
}
2021-12-10 01:21:01 +01:00
buttons . unshift ( {
class : "montrer" ,
icon : "fas fa-comment" ,
2022-12-29 02:25:45 +01:00
onclick : ev => this . item . postItemToChat ( )
2021-12-10 01:21:01 +01:00
} ) ;
2021-01-01 21:11:56 +01:00
return buttons
}
2020-05-21 21:48:20 +02:00
2021-01-01 21:11:56 +01:00
/* -------------------------------------------- */
2020-05-21 21:48:20 +02:00
/** @override */
2021-05-07 17:27:02 +02:00
setPosition ( options = { } ) {
2020-05-21 21:48:20 +02:00
const position = super . setPosition ( options ) ;
2021-05-10 19:14:05 +02:00
const sheetHeader = this . element . find ( ".sheet-header" ) ;
2020-05-21 21:48:20 +02:00
const sheetBody = this . element . find ( ".sheet-body" ) ;
2021-05-10 19:14:05 +02:00
const bodyHeight = position . height - sheetHeader [ 0 ] . clientHeight ;
2020-05-21 21:48:20 +02:00
sheetBody . css ( "height" , bodyHeight ) ;
return position ;
}
2021-05-07 17:27:02 +02:00
2020-12-04 20:52:04 +01:00
/* -------------------------------------------- */
2020-12-15 21:28:55 +01:00
async getData ( ) {
2021-05-07 17:27:02 +02:00
let formData = {
2022-09-07 18:47:56 +02:00
title : this . item . name ,
2023-01-28 16:34:09 +01:00
id : this . item . id ,
2022-09-07 18:47:56 +02:00
type : this . item . type ,
img : this . item . img ,
name : this . item . name ,
system : this . item . system ,
2021-12-05 01:50:09 +01:00
actorId : this . actor ? . id ,
2022-12-03 15:33:16 +01:00
description : await TextEditor . enrichHTML ( this . item . system . description , { async : true } ) ,
2022-12-03 22:32:32 +01:00
descriptionmj : await TextEditor . enrichHTML ( this . item . system . descriptionmj , { async : true } ) ,
2023-01-28 16:34:09 +01:00
isComestible : this . item . getUtilisationCuisine ( ) ,
2024-06-29 00:06:19 +02:00
options : RdDSheetUtility . mergeDocumentRights ( this . options , this . item , this . isEditable ) ,
2024-11-28 00:38:34 +01:00
competences : await SystemCompendiums . getCompetences ( 'personnage' ) ,
categories : RdDItem . getCategories ( this . item . type ) ,
2021-03-25 09:28:36 +01:00
}
2024-11-28 00:38:34 +01:00
2024-09-25 22:56:24 +02:00
if ( this . item . type == ITEM _TYPES . competencecreature ) {
2023-06-13 01:55:38 +02:00
formData . isparade = RdDItemCompetenceCreature . isParade ( this . item )
formData . isdommages = RdDItemCompetenceCreature . isDommages ( this . item )
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . tache ||
this . item . type == ITEM _TYPES . livre ||
this . item . type == ITEM _TYPES . meditation ||
this . item . type == ITEM _TYPES . oeuvre ) {
2024-06-07 11:12:00 +02:00
formData . caracList = foundry . utils . duplicate ( game . model . Actor . personnage . carac )
formData . caracList [ "reve-actuel" ] = foundry . utils . duplicate ( game . model . Actor . personnage . reve . reve )
2020-12-15 21:28:55 +01:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . arme ) {
formData . competences = formData . competences . filter ( it => it . isCompetenceArme ( ) )
2022-11-01 00:48:46 +01:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . recettecuisine ) {
2022-12-03 15:33:16 +01:00
formData . ingredients = await TextEditor . enrichHTML ( this . object . system . ingredients , { async : true } )
2022-11-16 03:00:38 +01:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . extraitpoetique ) {
2022-12-03 15:33:16 +01:00
formData . extrait = await TextEditor . enrichHTML ( this . object . system . extrait , { async : true } )
formData . texte = await TextEditor . enrichHTML ( this . object . system . texte , { async : true } )
2022-09-27 21:03:18 +02:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . recettealchimique ) {
RdDAlchimie . processManipulation ( this . item , this . actor ? . id ) ;
2022-12-03 15:33:16 +01:00
formData . manipulation _update = await TextEditor . enrichHTML ( this . object . system . manipulation _update , { async : true } )
formData . utilisation = await TextEditor . enrichHTML ( this . object . system . utilisation , { async : true } )
formData . enchantement = await TextEditor . enrichHTML ( this . object . system . enchantement , { async : true } )
formData . sureffet = await TextEditor . enrichHTML ( this . object . system . sureffet , { async : true } )
2021-01-07 20:04:10 +01:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . gemme ) {
2021-10-29 09:53:35 +02:00
formData . gemmeTypeList = RdDGemme . getGemmeTypeOptionList ( ) ;
2024-11-28 00:38:34 +01:00
RdDGemme . calculDataDerivees ( this . item )
2021-10-29 09:53:35 +02:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . potion ) {
RdDHerbes . calculFormData ( formData , this . item )
2021-05-07 17:27:02 +02:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . herbe ) {
if ( formData . options . isOwned && [ 'Soin' , 'Repos' ] . includes ( formData . system . categorie ) ) {
formData . isIngredientPotionBase = true ;
}
2020-12-15 08:37:52 +01:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . sortreserve ) {
2022-09-17 16:07:38 +02:00
const sortId = this . item . system . sortid ;
2024-11-28 00:38:34 +01:00
formData . competences = formData . competences . filter ( it => RdDItemCompetence . isDraconic ( it ) ) ;
2023-01-28 16:34:09 +01:00
formData . sort = formData . options . isOwned ? this . item . actor . items . get ( sortId ) : game . items . get ( sortId ) ;
2022-09-17 16:07:38 +02:00
}
2024-11-28 00:38:34 +01:00
if ( this . item . type == ITEM _TYPES . sort ) {
formData . competences = formData . competences . filter ( it => RdDItemCompetence . isDraconic ( it ) ) ;
formData . bonusCaseList = RdDItemSort . getBonusCaseList ( this . item ) ;
}
2021-03-16 22:56:57 +01:00
return formData ;
2020-12-04 20:52:04 +01:00
}
2021-05-07 17:27:02 +02:00
2020-05-21 21:48:20 +02:00
/* -------------------------------------------- */
/** @override */
2021-05-07 17:27:02 +02:00
activateListeners ( html ) {
2020-05-21 21:48:20 +02:00
super . activateListeners ( html ) ;
2022-12-09 02:00:31 +01:00
this . html = html ;
2023-06-20 23:43:24 +02:00
HtmlUtility . showControlWhen ( this . html . find ( ".item-cout" ) , ReglesOptionnelles . isUsing ( 'afficher-prix-joueurs' )
2023-01-28 16:34:09 +01:00
|| game . user . isGM
|| ! this . item . isOwned ) ;
2023-01-10 22:11:16 +01:00
HtmlUtility . showControlWhen ( this . html . find ( ".item-magique" ) , this . item . isMagique ( ) ) ;
2021-12-05 01:50:09 +01:00
2020-05-21 21:48:20 +02:00
// Everything below here is only needed if the sheet is editable
if ( ! this . options . editable ) return ;
2022-12-09 02:00:31 +01:00
2022-12-03 18:29:29 +01:00
this . form . ondragstart = ( event ) => this . _onDragStart ( event ) ;
this . form . ondrop = ( event ) => this . _onDrop ( event ) ;
2020-05-22 19:28:01 +02:00
// Select competence categorie
2022-12-09 02:00:31 +01:00
this . html . find ( ".categorie" ) . change ( event => this . _onSelectCategorie ( event ) ) ;
2020-12-15 21:28:55 +01:00
2022-12-09 02:00:31 +01:00
this . html . find ( '.sheet-competence-xp' ) . change ( ( event ) => {
2022-10-08 14:25:31 +02:00
if ( this . item . isCompetencePersonnage ( ) ) {
2022-09-07 18:47:56 +02:00
RdDUtility . checkThanatosXP ( this . item . name ) ;
2021-02-06 23:51:04 +01:00
}
2021-05-07 17:27:02 +02:00
} ) ;
2022-12-12 22:51:38 +01:00
this . html . find ( ".item-cout input[name='system.cout']" ) . change ( event => {
if ( this . item . isMonnaie ( ) ) {
const value = event . currentTarget . value ;
if ( Number ( value ) == 0 ) {
ui . notifications . error ( ` ${ this . actor ? . name ? ? 'Monnaie' } : La monnaie ${ this . item . name } a maintenant une valeur de 0, et ne peut plus être utilisée pour payer! ` )
}
}
} )
2024-11-28 00:38:34 +01:00
this . html . find ( '.delete-bonus-case' ) . click ( ( event ) => {
this . supprimerBonusCase ( event . currentTarget . attributes [ 'data-deleteCoord' ] . value )
} )
2021-02-06 23:51:04 +01:00
2023-01-05 00:55:04 +01:00
this . html . find ( '.date-enchantement' ) . change ( ( event ) => {
const jour = Number ( this . html . find ( 'input.date-enchantement[name="enchantement.jour"]' ) . val ( ) ) ;
const mois = RdDTimestamp . definition ( this . html . find ( 'select.date-enchantement[name="enchantement.mois"]' ) . val ( ) ) ;
const indexDate = game . system . rdd . calendrier . getIndexFromDate ( jour , mois . heure ) ;
2023-01-07 23:58:33 +01:00
this . item . update ( { 'system.prdate' : indexDate } ) ;
2023-01-05 00:55:04 +01:00
console . warn ( ` Date d'enchantement modifiée ${ jour } / ${ mois . heure } : ${ indexDate } ` )
2021-04-04 18:37:16 +02:00
} ) ;
2022-12-09 02:00:31 +01:00
this . html . find ( '.creer-tache-livre' ) . click ( ( event ) => this . _getEventActor ( event ) . creerTacheDepuisLivre ( this . item ) ) ;
2023-03-30 02:59:07 +02:00
this . html . find ( '.consommer-potion' ) . click ( ( event ) => this . _getEventActor ( event ) . consommerPotion ( this . item , this . getActionRenderItem ( ) ) ) ;
2023-10-24 22:24:54 +02:00
this . html . find ( '.creer-potion-base' ) . click ( ( event ) => this . _getEventActor ( event ) . actionHerbe ( this . item ) ) ;
2023-11-10 22:38:33 +01:00
this . html . find ( 'input[name="system.cacher_points_de_tache"]' ) . change ( async event => await this . item . update ( { 'system.cacher_points_de_tache' : event . currentTarget . checked } ) ) ;
2021-05-07 17:27:02 +02:00
2022-12-09 02:00:31 +01:00
this . html . find ( '.alchimie-tache a' ) . click ( ( event ) => {
2022-12-05 15:29:00 +01:00
let actor = this . _getEventActor ( event ) ;
2021-05-07 17:27:02 +02:00
if ( actor ) {
2022-12-05 15:29:00 +01:00
let recetteId = event . currentTarget . attributes [ 'data-recette-id' ] . value ;
let tacheName = event . currentTarget . attributes [ 'data-alchimie-tache' ] . value ;
let tacheData = event . currentTarget . attributes [ 'data-alchimie-data' ] . value ;
2021-01-07 20:04:10 +01:00
actor . effectuerTacheAlchimie ( recetteId , tacheName , tacheData ) ;
} else {
2022-06-12 13:58:55 +02:00
ui . notifications . info ( "Impossible trouver un acteur pour réaliser cette tache Alchimique." ) ;
2021-01-07 20:04:10 +01:00
}
} ) ;
2021-05-07 17:27:02 +02:00
2023-03-30 02:59:07 +02:00
if ( this . actor ) {
this . html . find ( '.item-split' ) . click ( async event => RdDSheetUtility . splitItem ( RdDSheetUtility . getItem ( event , this . actor ) , this . actor , this . getActionRenderItem ( ) ) ) ;
this . html . find ( '.item-edit' ) . click ( async event => RdDSheetUtility . getItem ( event , this . actor ) ? . sheet . render ( true ) ) ;
this . html . find ( '.item-delete' ) . click ( async event => RdDUtility . confirmActorItemDelete ( this , RdDSheetUtility . getItem ( event , this . actor ) ) ) ;
this . html . find ( '.item-vendre' ) . click ( async event => RdDSheetUtility . getItem ( event , this . actor ) ? . proposerVente ( ) ) ;
this . html . find ( '.item-montrer' ) . click ( async event => RdDSheetUtility . getItem ( event , this . actor ) ? . postItemToChat ( ) ) ;
this . html . find ( '.item-action' ) . click ( async event => RdDSheetUtility . getItem ( event , this . actor ) ? . actionPrincipale ( this . actor , this . getActionRenderItem ( ) ) ) ;
2023-03-30 02:56:06 +02:00
this . html . find ( '.item-quantite-plus' ) . click ( async event => {
await this . actor . itemQuantiteIncDec ( RdDSheetUtility . getItemId ( event ) , 1 )
this . render ( ) ;
} ) ;
this . html . find ( '.item-quantite-moins' ) . click ( async event => {
await this . actor . itemQuantiteIncDec ( RdDSheetUtility . getItemId ( event ) , - 1 )
this . render ( ) ;
} ) ;
2023-03-30 02:59:07 +02:00
}
2023-01-07 23:58:33 +01:00
2024-05-02 14:08:02 +02:00
const updateItemTimestamp = ( path , timestamp ) => this . item . update ( { [ path ] : foundry . utils . duplicate ( timestamp ) } )
2023-01-07 23:58:33 +01:00
RdDTimestamp . handleTimestampEditor ( this . html , 'system.temporel.debut' , updateItemTimestamp ) ;
RdDTimestamp . handleTimestampEditor ( this . html , 'system.temporel.fin' , updateItemTimestamp ) ;
2022-12-05 15:29:00 +01:00
}
2023-03-30 02:59:07 +02:00
getActionRenderItem ( ) {
return async ( ) => {
let item = this . item ;
while ( item ) {
await item . sheet ? . render ( )
item = this . actor . getContenant ( item )
}
}
}
2022-12-05 15:29:00 +01:00
_getEventActor ( event ) {
let actorId = event . currentTarget . attributes [ 'data-actor-id' ] . value ;
let actor = game . actors . get ( actorId ) ;
return actor ;
2020-05-21 21:48:20 +02:00
}
2021-05-07 17:27:02 +02:00
2023-01-07 23:58:33 +01:00
2020-05-21 21:48:20 +02:00
/* -------------------------------------------- */
2021-05-06 21:34:07 +02:00
async _onSelectCategorie ( event ) {
2020-05-21 21:48:20 +02:00
event . preventDefault ( ) ;
2021-05-06 21:34:07 +02:00
2022-09-07 18:47:56 +02:00
if ( this . item . isCompetence ( ) ) {
2023-06-13 01:55:38 +02:00
const categorie = event . currentTarget . value ;
2024-09-27 22:39:49 +02:00
const level = RdDItemCompetence . getNiveauBase ( categorie , this . item . type ) ;
2022-09-07 18:47:56 +02:00
this . item . system . base = level ;
2022-12-09 02:00:31 +01:00
this . html . find ( '[name="system.base"]' ) . val ( level ) ;
2021-05-06 21:34:07 +02:00
}
2020-05-22 19:28:01 +02:00
}
2020-05-21 21:48:20 +02:00
2024-11-28 00:38:34 +01:00
async supprimerBonusCase ( deleteCoord ) {
if ( this . item . type == ITEM _TYPES . sort ) {
const oldList = RdDItemSort . getBonusCaseList ( this . item )
const newList = oldList . filter ( it => it . case != deleteCoord ) ;
if ( newList . length != oldList . length ) {
await this . item . update ( {
'system.bonuscase' : RdDItemSort . bonuscasesToString ( newList )
} )
}
}
}
2020-05-22 19:28:01 +02:00
/* -------------------------------------------- */
2020-05-21 21:48:20 +02:00
/** @override */
2022-10-21 02:10:37 +02:00
_updateObject ( event , formData ) {
2024-10-26 21:37:47 +02:00
switch ( this . item . type ) {
case ITEM _TYPES . sort :
2024-11-28 00:38:34 +01:00
formData [ 'system.bonuscase' ] = RdDItemSort . bonuscasesToString ( RdDItemSheet . _listCaseTmr (
formData . caseTmrCoord ,
formData . caseTmrBonus ,
formData . caseTmrAdd
) )
2024-10-26 21:37:47 +02:00
break
case ITEM _TYPES . competence :
2024-11-28 00:38:34 +01:00
formData [ 'system.niveau' ] = formData . system . niveau ? ? formData . system . base
break
2022-12-03 15:33:16 +01:00
}
2024-10-26 21:37:47 +02:00
2022-09-07 18:47:56 +02:00
return this . item . update ( formData ) ;
2020-05-21 21:48:20 +02:00
}
2021-12-05 01:50:09 +01:00
2024-11-28 00:38:34 +01:00
/* -------------------------------------------- */
/ * *
* reconstruit les bonus de cases
* @ param { * } caseTmrCoord tableau des coordonées
* @ param { * } caseTmrBonus tableau des bonus
* @ param { * } caseTmrAdd case à ajouter
* @ returns list d ' objets { coord , bonus }
* /
static _listCaseTmr ( caseTmrCoord , caseTmrBonus , caseTmrAdd ) {
const listCaseTmrCoord = caseTmrCoord == undefined ? [ ] : Array . isArray ( caseTmrCoord ) ? caseTmrCoord : [ caseTmrCoord ]
const listCaseTmrBonus = caseTmrBonus == undefined ? [ ] : Array . isArray ( caseTmrBonus ) ? caseTmrBonus : [ caseTmrBonus ]
if ( caseTmrAdd != undefined && caseTmrAdd != '' && TMRUtility . verifyTMRCoord ( caseTmrAdd ) && ! listCaseTmrCoord . includes ( caseTmrAdd ) ) {
listCaseTmrCoord . push ( TMRUtility . getTMR ( caseTmrAdd ) . coord )
listCaseTmrBonus . push ( 1 )
}
const list = [ ] ;
const caseChecked = { } ;
for ( let i = 0 ; i < listCaseTmrBonus . length && i < listCaseTmrCoord . length ; i ++ ) {
const coord = listCaseTmrCoord [ i ] == FLEUVE _COORD ? FLEUVE _COORD : ( listCaseTmrCoord [ i ] ? . toUpperCase ( ) ? ? 'A1' )
const bonus = listCaseTmrBonus [ i ] ? ? 0
if ( TMRUtility . verifyTMRCoord ( coord ) && bonus >= 0 && ! caseChecked [ coord ] ) {
caseChecked [ coord ] = coord
list . push ( { case : coord , bonus : bonus } )
}
}
return list
}
2022-12-03 18:29:29 +01:00
/* -------------------------------------------- */
2021-12-05 16:48:18 +01:00
async _onDragStart ( event ) {
}
async _onDrop ( event ) {
2022-09-07 18:47:56 +02:00
// Try to extract the dragData
2022-12-03 18:29:29 +01:00
let dragData = RdDItemSheet . $extractDragData ( event ) ;
if ( ! dragData ) return false ;
2022-09-07 18:47:56 +02:00
const allowed = Hooks . call ( "dropActorSheetData" , this . actor , this , dragData ) ;
2022-12-03 18:29:29 +01:00
if ( allowed === false ) return false ;
2021-12-05 16:48:18 +01:00
2022-09-07 18:47:56 +02:00
// Handle different dragData types
switch ( dragData . type ) {
2021-12-05 16:48:18 +01:00
case "Item" :
2022-09-07 18:47:56 +02:00
return this . _onDropItem ( event , dragData ) ;
2022-12-03 18:29:29 +01:00
case "Actor" :
return this . _onDropActor ( event , dragData ) ;
2021-12-05 16:48:18 +01:00
}
return super . _onDrop ( event ) ;
}
2022-12-03 18:29:29 +01:00
static $extractDragData ( event ) {
try {
const eventData = event ? . dataTransfer ? . getData ( 'text/plain' ) ;
if ( eventData ) {
return JSON . parse ( eventData ) ;
}
} catch ( err ) { }
return undefined ;
}
2021-12-05 16:48:18 +01:00
async _onDropItem ( event , dragData ) {
}
2022-12-03 18:29:29 +01:00
async _onDropActor ( event , dragData ) {
}
2021-12-05 01:50:09 +01:00
2020-05-21 21:48:20 +02:00
}