@@ -19,17 +19,17 @@ export function initConfig() {
19
19
20
20
const getActivationType = ( item ) => {
21
21
if ( ! item ?. system ?. activities ) {
22
- return
22
+ return ;
23
23
}
24
24
return Array . from ( item . system . activities ) [ 0 ] ?. activation ?. type ;
25
- }
25
+ } ;
26
26
27
27
const getActionType = ( item ) => {
28
28
if ( ! item ?. system ?. activities ) {
29
- return
29
+ return ;
30
30
}
31
31
return Array . from ( item . system . activities ) [ 0 ] ?. actionType ;
32
- }
32
+ } ;
33
33
34
34
const actionTypes = {
35
35
action : [ "action" ] ,
@@ -714,8 +714,8 @@ export function initConfig() {
714
714
}
715
715
716
716
get activity ( ) {
717
- if ( ! this . item ?. system ?. activities ) {
718
- return
717
+ if ( ! this . item ?. system ?. activities ) {
718
+ return ;
719
719
}
720
720
return Array . from ( this . item . system . activities ) [ 0 ] ;
721
721
}
@@ -971,6 +971,7 @@ export function initConfig() {
971
971
constructor ( specialItem ) {
972
972
super ( ) ;
973
973
const actorItem = this . actor . items . getName ( specialItem . name ) ;
974
+ this . actorItem = actorItem ;
974
975
this . item =
975
976
actorItem ??
976
977
new CONFIG . Item . documentClass ( specialItem , {
@@ -990,25 +991,69 @@ export function initConfig() {
990
991
return true ;
991
992
}
992
993
994
+ get activity ( ) {
995
+ if ( ! this . item ?. system ?. activities ) {
996
+ return ;
997
+ }
998
+ return Array . from ( this . item . system . activities ) [ 0 ] ;
999
+ }
1000
+
993
1001
async getTooltipData ( ) {
994
1002
const tooltipData = await getTooltipDetails ( this . item ) ;
995
1003
tooltipData . propertiesLabel = "enhancedcombathud-dnd5e.tooltip.properties.name" ;
996
1004
return tooltipData ;
997
1005
}
998
1006
999
1007
async _onLeftClick ( event ) {
1000
- const useCE = game . modules . get ( "dfreds-convenient-effects" ) ?. active && game . dfreds . effectInterface . findEffect ( { effectName : this . label } ) ;
1008
+ const useCE = game . modules . get ( "dfreds-convenient-effects" ) ?. active && game . dfreds . effectInterface . findEffect ( { effectName : this . label } ) ;
1001
1009
let success = false ;
1002
1010
if ( useCE ) {
1003
1011
success = true ;
1004
- await game . dfreds . effectInterface . toggleEffect ( { effectName : this . label , overlay : false , uuids : [ this . actor . uuid ] } ) ;
1012
+ await game . dfreds . effectInterface . toggleEffect ( { effectName : this . label , overlay : false , uuids : [ this . actor . uuid ] } ) ;
1005
1013
} else {
1006
- success = await this . item . use ( { event } , { event } ) ;
1014
+ success = this . actorItem ? await this . activity . use ( { event } , { event } ) : await this . createChatMessage ( ) ;
1007
1015
}
1008
1016
if ( success ) {
1009
1017
DND5eItemButton . consumeActionEconomy ( this . item ) ;
1010
1018
}
1011
1019
}
1020
+
1021
+ async createChatMessage ( ) {
1022
+ return await ChatMessage . create ( {
1023
+ user : game . user ,
1024
+ speaker : {
1025
+ actor : this . actor ,
1026
+ token : this . actor . token ,
1027
+ alias : this . actor . name ,
1028
+ } ,
1029
+ content : `
1030
+ <div class="dnd5e2 chat-card item-card" data-display-challenge="">
1031
+
1032
+ <section class="card-header description collapsible">
1033
+
1034
+ <header class="summary">
1035
+ <img class="gold-icon" src="${ this . icon } ">
1036
+ <div class="name-stacked border">
1037
+ <span class="title">${ this . label } </span>
1038
+ <span class="subtitle">
1039
+ Feature
1040
+ </span>
1041
+ </div>
1042
+ <i class="fas fa-chevron-down fa-fw"></i>
1043
+ </header>
1044
+
1045
+ <section class="details collapsible-content card-content">
1046
+ <div class="wrapper">
1047
+ ${ this . item . system . description . value }
1048
+ </div>
1049
+ </section>
1050
+ </section>
1051
+
1052
+
1053
+ </div>
1054
+ ` ,
1055
+ } ) ;
1056
+ }
1012
1057
}
1013
1058
1014
1059
class DND5eMovementHud extends ARGON . MovementHud {
0 commit comments