38 lines
		
	
	
		
			961 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			961 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /**
 | |
|  * Extend the basic Item with some very simple modifications.
 | |
|  * @extends {Item}
 | |
|  */
 | |
| export class frostgraveItem extends Item {
 | |
|   /**
 | |
|    * Augment the basic Item data model with additional dynamic data.
 | |
|    */
 | |
|   prepareData() {
 | |
|     super.prepareData();
 | |
| 
 | |
|     // Get the Item's data
 | |
|     const itemData = this.data;
 | |
|     const actorData = this.actor ? this.actor.data : {};
 | |
|     const data = itemData.data;
 | |
|   }
 | |
| 
 | |
|   /**
 | |
|    * Handle clickable rolls.
 | |
|    * @param {Event} event   The originating click event
 | |
|    * @private
 | |
|    */
 | |
|   async roll() {
 | |
|     // Basic template rendering data
 | |
|     const token = this.actor.token;
 | |
|     const item = this.data;
 | |
|     const actorData = this.actor ? this.actor.data.data : {};
 | |
|     const itemData = item.data;
 | |
| 
 | |
|     let roll = new Roll("d20+@stats.fight.value", actorData);
 | |
|     let label = `Rolling ${item.name}`;
 | |
|     roll.roll().toMessage({
 | |
|       speaker: ChatMessage.getSpeaker({ actor: this.actor }),
 | |
|       flavor: label,
 | |
|     });
 | |
|   }
 | |
| }
 |