added tomes and rituals to actor sheets
This commit is contained in:
@@ -288,6 +288,14 @@
|
||||
"TYPES.Item.gear": "Gear",
|
||||
"TYPES.Item.motivation": "Motivation",
|
||||
"TYPES.Item.weapon": "Weapon",
|
||||
"TYPES.Item.tome": "Tome",
|
||||
"TYPES.Item.ritual": "Ritual",
|
||||
|
||||
"DG.Gear.Tomes": "TOMES",
|
||||
"DG.Gear.Rituals": "RITUALS",
|
||||
|
||||
"DG.Tomes.Name": "Name",
|
||||
"DG.Ritual.Name": "Name",
|
||||
|
||||
"DG.Tome.Name": "Name",
|
||||
"DG.ItemWindow.Tome.Description": "Description",
|
||||
|
||||
@@ -145,6 +145,8 @@ export default class DeltaGreenActorSheet extends ActorSheet {
|
||||
const armor = [];
|
||||
const weapons = [];
|
||||
const gear = [];
|
||||
const tomes = [];
|
||||
const rituals = [];
|
||||
|
||||
// Iterate through items, allocating to containers
|
||||
// let totalWeight = 0;
|
||||
@@ -158,6 +160,10 @@ export default class DeltaGreenActorSheet extends ActorSheet {
|
||||
weapons.push(i);
|
||||
} else if (i.type === "gear") {
|
||||
gear.push(i);
|
||||
} else if (i.type === "tome") {
|
||||
tomes.push(i);
|
||||
} else if (i.type === "ritual") {
|
||||
rituals.push(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,10 +221,48 @@ export default class DeltaGreenActorSheet extends ActorSheet {
|
||||
});
|
||||
}
|
||||
|
||||
if (actorData.system.settings.sorting.tomeSortAlphabetical) {
|
||||
tomes.sort(function (a, b) {
|
||||
let x = a.name.toLowerCase();
|
||||
let y = b.name.toLowerCase();
|
||||
if (x < y) {
|
||||
return -1;
|
||||
}
|
||||
if (x > y) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
} else {
|
||||
tomes.sort(function (a, b) {
|
||||
return a.sort - b.sort;
|
||||
});
|
||||
}
|
||||
|
||||
if (actorData.system.settings.sorting.ritualSortAlphabetical) {
|
||||
rituals.sort(function (a, b) {
|
||||
let x = a.name.toLowerCase();
|
||||
let y = b.name.toLowerCase();
|
||||
if (x < y) {
|
||||
return -1;
|
||||
}
|
||||
if (x > y) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
} else {
|
||||
rituals.sort(function (a, b) {
|
||||
return a.sort - b.sort;
|
||||
});
|
||||
}
|
||||
|
||||
// Assign and return
|
||||
actorData.armor = armor;
|
||||
actorData.weapons = weapons;
|
||||
actorData.gear = gear;
|
||||
actorData.rituals = rituals;
|
||||
actorData.tomes = tomes;
|
||||
}
|
||||
|
||||
// Can add extra buttons to form header here if necessary
|
||||
@@ -566,6 +610,16 @@ export default class DeltaGreenActorSheet extends ActorSheet {
|
||||
"system.settings.sorting.gearSortAlphabetical":
|
||||
!this.actor.system.settings.sorting.gearSortAlphabetical,
|
||||
});
|
||||
} else if (itemType === "tome") {
|
||||
this.actor.update({
|
||||
"system.settings.sorting.tomeSortAlphabetical":
|
||||
!this.actor.system.settings.sorting.tomeSortAlphabetical,
|
||||
});
|
||||
} else if (itemType === "ritual") {
|
||||
this.actor.update({
|
||||
"system.settings.sorting.ritualSortAlphabetical":
|
||||
!this.actor.system.settings.sorting.ritualSortAlphabetical,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+3
-1
@@ -45,7 +45,9 @@
|
||||
"sorting": {
|
||||
"weaponSortAlphabetical": false,
|
||||
"armorSortAlphabetical": false,
|
||||
"gearSortAlphabetical": false
|
||||
"gearSortAlphabetical": false,
|
||||
"tomeSortAlphabetical": false,
|
||||
"ritualSortAlphabetical": false
|
||||
},
|
||||
"rolling": {
|
||||
"defaultPercentileModifier": 20
|
||||
|
||||
@@ -211,4 +211,102 @@
|
||||
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
|
||||
{{!-- TOMES --}}
|
||||
|
||||
<div>
|
||||
|
||||
<div class="horizontal-bar-section-divider">
|
||||
<span>{{localize 'DG.Gear.Tomes'}}</span>
|
||||
</div>
|
||||
|
||||
<ol class="items-list">
|
||||
|
||||
<li class="item flexrow item-header">
|
||||
|
||||
<div class="item-image">
|
||||
{{#if actor.system.settings.sorting.tomeSortAlphabetical}}
|
||||
<a><i class="toggle-item-sorting-style fa-solid fa-solid fa-arrow-down-a-z" data-gear-type="tome"></i></a>
|
||||
{{else}}
|
||||
<a><i class="toggle-item-sorting-style fa-solid fa-arrow-down-short-wide" data-gear-type="tome"></i></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div style="min-width: 55%;" class="item-name">{{localize 'DG.Tomes.Name'}}</div>
|
||||
|
||||
<div class="item-controls">
|
||||
<a class="item-control item-create action-pill" title="Create item" data-type="tome"><i class="fas fa-plus"></i> {{localize 'DG.Generic.AddButtonLabel'}}</a>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
{{#each actor.tomes as |item id|}}
|
||||
|
||||
<li class="item flexrow" data-item-id="{{item._id}}">
|
||||
|
||||
<div class="item-image"><img src="{{item.img}}" title="{{item.name}}" width="24" height="24"/></div>
|
||||
|
||||
<h4 style="word-wrap: break-word; min-width: 55%;" class="item-name">{{item.name}}</h4>
|
||||
|
||||
<div class="item-controls">
|
||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
{{/each}}
|
||||
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
|
||||
{{!-- RITUALS --}}
|
||||
|
||||
<div>
|
||||
|
||||
<div class="horizontal-bar-section-divider">
|
||||
<span>{{localize 'DG.Gear.Rituals'}}</span>
|
||||
</div>
|
||||
|
||||
<ol class="items-list">
|
||||
|
||||
<li class="item flexrow item-header">
|
||||
|
||||
<div class="item-image">
|
||||
{{#if actor.system.settings.sorting.ritualSortAlphabetical}}
|
||||
<a><i class="toggle-item-sorting-style fa-solid fa-solid fa-arrow-down-a-z" data-gear-type="ritual"></i></a>
|
||||
{{else}}
|
||||
<a><i class="toggle-item-sorting-style fa-solid fa-arrow-down-short-wide" data-gear-type="ritual"></i></a>
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<div style="min-width: 55%;" class="item-name">{{localize 'DG.Ritual.Name'}}</div>
|
||||
|
||||
<div class="item-controls">
|
||||
<a class="item-control item-create action-pill" title="Create item" data-type="ritual"><i class="fas fa-plus"></i> {{localize 'DG.Generic.AddButtonLabel'}}</a>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
{{#each actor.rituals as |item id|}}
|
||||
|
||||
<li class="item flexrow" data-item-id="{{item._id}}">
|
||||
|
||||
<div class="item-image"><img src="{{item.img}}" title="{{item.name}}" width="24" height="24"/></div>
|
||||
|
||||
<h4 style="word-wrap: break-word; min-width: 55%;" class="item-name">{{item.name}}</h4>
|
||||
|
||||
<div class="item-controls">
|
||||
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
|
||||
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
{{/each}}
|
||||
|
||||
</ol>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user