New source found from dndbeyond.com
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import { ContainerAccessors } from '.';
|
||||
import { PartyInventorySharingStateEnum } from '../Campaign';
|
||||
import { ItemAccessors } from '../Item';
|
||||
import { getDefinitionKey, getItemMappingIds, getName } from './accessors';
|
||||
import { getDefinitionKey, getItemMappingIds, getName, isShared } from './accessors';
|
||||
import { ContainerTypeEnum } from './constants';
|
||||
/**
|
||||
*
|
||||
@@ -51,14 +49,14 @@ export function getInventoryItems(container, inventory) {
|
||||
* @param containers
|
||||
* @returns {Array<MenuOption>}
|
||||
*/
|
||||
export function getGroupedOptions(currentContainerDefinitionKey, containers, label, sharingState) {
|
||||
export function getGroupedOptions(currentContainerDefinitionKey, containers, label) {
|
||||
const excludedKeys = [];
|
||||
if (currentContainerDefinitionKey) {
|
||||
excludedKeys.push(currentContainerDefinitionKey);
|
||||
}
|
||||
const availableContainers = getAvailableContainers(containers, excludedKeys);
|
||||
const characterContainers = availableContainers.filter((container) => !ContainerAccessors.isShared(container));
|
||||
const partyContainers = availableContainers.filter(ContainerAccessors.isShared);
|
||||
const characterContainers = availableContainers.filter((container) => !isShared(container));
|
||||
const partyContainers = availableContainers.filter(isShared);
|
||||
const options = [];
|
||||
if (characterContainers.length) {
|
||||
options.push({
|
||||
@@ -69,9 +67,8 @@ export function getGroupedOptions(currentContainerDefinitionKey, containers, lab
|
||||
})),
|
||||
});
|
||||
}
|
||||
// Only display Party inventory if there are containers and the sharing state is turned to on
|
||||
// ( e.g. hide these containers as options when OFF and in DELETE_ONLY )
|
||||
if (partyContainers.length && sharingState === PartyInventorySharingStateEnum.ON) {
|
||||
// Only display Party inventory if there are containers
|
||||
if (partyContainers.length) {
|
||||
options.push({
|
||||
label: `${!characterContainers.length ? `${label} ` : ''}Party Inventory`,
|
||||
options: partyContainers.map((container) => ({
|
||||
|
||||
Reference in New Issue
Block a user