1- import { FU , systemPath } from '../helpers/config.mjs' ;
1+ import { FU } from '../helpers/config.mjs' ;
22import { InlineHelper , InlineSourceInfo } from '../helpers/inline-helper.mjs' ;
33import { targetHandler } from '../helpers/target-handler.mjs' ;
44import { CharacterDataModel } from '../documents/actors/character/character-data-model.mjs' ;
@@ -11,6 +11,7 @@ import { InlineEffects } from './inline-effects.mjs';
1111import { StringUtils } from '../helpers/string-utils.mjs' ;
1212import { systemAssetPath } from '../helpers/system-utils.mjs' ;
1313import { CustomWeaponDataModel } from '../documents/items/customWeapon/custom-weapon-data-model.mjs' ;
14+ import FoundryUtils from '../helpers/foundry-utils.mjs' ;
1415
1516const INLINE_WEAPON = 'InlineWeapon' ;
1617const className = `inline-weapon` ;
@@ -139,12 +140,14 @@ function createAlterDamageTypeEffect(weapon, type, label) {
139140async function applyEffectToWeapon ( actor , sourceInfo , choices , config ) {
140141 if ( actor . system instanceof CharacterDataModel ) {
141142 const source = sourceInfo . resolve ( ) ;
142- const weapon = await WeaponResolver . prompt ( actor , true ) ;
143- if ( ! weapon ) {
143+ const promptWeapon = await WeaponResolver . prompt ( actor , true ) ;
144+ if ( ! promptWeapon ) {
144145 ui . notifications . error ( 'FU.AbilityNoWeaponEquipped' , { localize : true } ) ;
145146 return ;
146147 }
147148
149+ const weapon = promptWeapon . item ;
150+
148151 const onApply = async ( choice ) => {
149152 choice = choice . trim ( ) ;
150153 if ( choice in FU . damageTypes ) {
@@ -167,15 +170,13 @@ async function applyEffectToWeapon(actor, sourceInfo, choices, config) {
167170 if ( isAny ) {
168171 choices = Object . keys ( FU . damageTypes ) ;
169172 }
170- const result = await foundry . applications . api . DialogV2 . wait ( {
171- window : { title : 'Select Damage Type' } ,
172- content : await foundry . applications . handlebars . renderTemplate ( systemPath ( 'templates/dialog/dialog-inline-weapon-enchant.hbs' ) ) ,
173- rejectClose : false ,
174- buttons : choices . map ( ( choice ) => ( {
175- action : choice ,
176- label : game . i18n . localize ( FU . damageTypes [ choice ] ) ,
177- } ) ) ,
178- } ) ;
173+ const options = choices . map ( ( choice ) => ( {
174+ label : game . i18n . localize ( FU . damageTypes [ choice ] ) ,
175+ value : choice ,
176+ icon : FU . affIcon [ choice ] ,
177+ } ) ) ;
178+ const result = await FoundryUtils . selectIconOptionDialog ( 'FU.SelectDamageType' , options ) ;
179+
179180 console . log ( result ) ;
180181 if ( result ) {
181182 onApply ( result ) ;
0 commit comments