Item chat desc bugfix
This commit is contained in:
+10
-3
@@ -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 = '\
|
||||
<div class="rollh2" style="text-transform: lowercase;">'+item.system.roll+'</div>\
|
||||
<div class="roll-grid">\
|
||||
@@ -3665,6 +3664,12 @@ export class MothershipActor extends Actor {
|
||||
</div>';
|
||||
}
|
||||
|
||||
//add flag to swap name and description, if desc contains trinket or patch
|
||||
if(item.system.description === '<p>Patch</p>' || item.system.description === '<p>Trinket</p>' || item.system.description === '<p>Maintenance Issue</p>') {
|
||||
swapNameDesc = true;
|
||||
swapName = item.system.description.replaceAll('<p>','').replaceAll('</p>','');
|
||||
}
|
||||
|
||||
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 = {
|
||||
|
||||
@@ -4,12 +4,8 @@
|
||||
<div class="showlessinfo"></div>
|
||||
<div class="rollcontainer">
|
||||
<div class="flexrow">
|
||||
{{#if (compare 'str' item.system.description '===' '<p>Patch</p>')}}
|
||||
<div class="rollweaponh1" >PATCH</div>
|
||||
{{else if (compare 'str' item.system.description '===' '<p>Trinket</p>')}}
|
||||
<div class="rollweaponh1" >TRINKET</div>
|
||||
{{else if (compare 'str' item.system.description '===' '<p>Maintenance Issue</p>')}}
|
||||
<div class="rollweaponh1" >MAINTENANCE ISSUE</div>
|
||||
{{#if swapNameDesc}}
|
||||
<div class="rollweaponh1" >{{swapName}}</div>
|
||||
{{else}}
|
||||
{{#if (compare 'int' item.name.length '>=' 22)}}
|
||||
<div class="rollweaponh1" style="font-size: 0.75rem; padding-top: 7px;">{{item.name}}</div>
|
||||
@@ -59,17 +55,12 @@
|
||||
<div style="border-bottom: 1px solid #999; height: 0; width: 100%;"></div>
|
||||
<div style="margin-bottom : 5px;"></div>
|
||||
{{/if}}
|
||||
{{#if (compare 'str' item.system.description '===' '<p>Trinket</p>')}}
|
||||
{{#if swapNameDesc}}
|
||||
<div class="description">
|
||||
<div class="body">{{{item.name}}}</div>
|
||||
</div>
|
||||
<div style="margin-bottom : 16px;"></div>
|
||||
{{else if (compare 'str' item.system.description '===' '<p>Patch</p>')}}
|
||||
<div class="description">
|
||||
<div class="body">{{{item.name}}}</div>
|
||||
</div>
|
||||
<div style="margin-bottom : 16px;"></div>
|
||||
{{else if (compare 'str' item.system.description '===' '<p>Maintenance Issue</p>')}}
|
||||
{{else if (compare 'str' item.system.type '===' 'repair')}}
|
||||
<div class="description">
|
||||
{{#if item.system.major}}
|
||||
<div class="body"><strong>Major Repair</strong></div>
|
||||
|
||||
Reference in New Issue
Block a user