diff --git a/module/actor/actor.js b/module/actor/actor.js index 2968b14..f35e908 100644 --- a/module/actor/actor.js +++ b/module/actor/actor.js @@ -3647,17 +3647,16 @@ export class MothershipActor extends Actor { // Print the item description into the chat. chatDesc(item) { + let swapNameDesc = false; + let swapName = ''; let itemName = item.name?.charAt(0).toUpperCase() + item.name?.toLowerCase().slice(1); if (!item.name && isNaN(itemName)) itemName = item.charAt(0)?.toUpperCase() + item.toLowerCase().slice(1); - var rollInsert = ''; - if(item.system.roll){ let r = new Roll(item.system.roll, {}); r.evaluate({async: false}); - rollInsert = '\
'+item.system.roll+'
\
\ @@ -3665,6 +3664,12 @@ export class MothershipActor extends Actor {
'; } + //add flag to swap name and description, if desc contains trinket or patch + if(item.system.description === '

Patch

' || item.system.description === '

Trinket

' || item.system.description === '

Maintenance Issue

') { + swapNameDesc = true; + swapName = item.system.description.replaceAll('

','').replaceAll('

',''); + } + var templateData = { actor: this, stat: { @@ -3673,6 +3678,8 @@ export class MothershipActor extends Actor { item: item, insert: rollInsert, onlyDesc: true, + swapNameDesc: swapNameDesc, + swapName: swapName }; let chatData = { diff --git a/templates/chat/itemRoll.html b/templates/chat/itemRoll.html index 71d2714..e08d7fe 100644 --- a/templates/chat/itemRoll.html +++ b/templates/chat/itemRoll.html @@ -4,12 +4,8 @@
- {{#if (compare 'str' item.system.description '===' '

Patch

')}} -
PATCH
- {{else if (compare 'str' item.system.description '===' '

Trinket

')}} -
TRINKET
- {{else if (compare 'str' item.system.description '===' '

Maintenance Issue

')}} -
MAINTENANCE ISSUE
+ {{#if swapNameDesc}} +
{{swapName}}
{{else}} {{#if (compare 'int' item.name.length '>=' 22)}}
{{item.name}}
@@ -59,17 +55,12 @@
{{/if}} - {{#if (compare 'str' item.system.description '===' '

Trinket

')}} + {{#if swapNameDesc}}
{{{item.name}}}
- {{else if (compare 'str' item.system.description '===' '

Patch

')}} -
-
{{{item.name}}}
-
-
- {{else if (compare 'str' item.system.description '===' '

Maintenance Issue

')}} + {{else if (compare 'str' item.system.type '===' 'repair')}}
{{#if item.system.major}}
Major Repair