New source found from dndbeyond.com
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { keyBy, sortBy } from 'lodash';
|
||||
import { ConfigUtils } from '../../config';
|
||||
import { CampaignAccessors, CampaignUtils } from '../Campaign';
|
||||
import { CampaignAccessors } from '../Campaign';
|
||||
import { generateCoinWeight } from '../Character/generators';
|
||||
import { DefinitionHacks } from '../Definition';
|
||||
import { FeatureFlagEnum, FeatureFlagInfoUtils } from '../FeatureFlagInfo';
|
||||
import { ItemAccessors, ItemDerivers, ItemValidators } from '../Item';
|
||||
import { getDefinitionKey, getName, isShared } from './accessors';
|
||||
import { ContainerTypeEnum } from './constants';
|
||||
@@ -23,18 +22,12 @@ function generateInitialCoins() {
|
||||
* @param characterId
|
||||
* @param partyInfo
|
||||
* @param partyInventory
|
||||
* @param featureFlagInfo
|
||||
* @param characterCoin
|
||||
* @param preferences
|
||||
* @param ruleData
|
||||
*/
|
||||
export function generateContainers(items, customItems, characterId, partyInfo, partyInventory, featureFlagInfo, characterCoin, preferences, ruleData) {
|
||||
let sharingStateActive = false;
|
||||
if (partyInfo && CampaignUtils.isSharingStateActive(CampaignAccessors.getSharingState(partyInfo))) {
|
||||
sharingStateActive = true;
|
||||
}
|
||||
const partyInventoryActive = FeatureFlagInfoUtils.getFeatureFlagInfoValue(FeatureFlagEnum.RELEASE_GATE_IMS, featureFlagInfo) &&
|
||||
sharingStateActive;
|
||||
export function generateContainers(items, customItems, characterId, partyInfo, partyInventory, characterCoin, preferences, ruleData) {
|
||||
const partyInventoryActive = partyInfo !== null;
|
||||
const rulesEngineConfig = ConfigUtils.getCurrentRulesEngineConfig();
|
||||
// Do we want to display Cointainers? You betcha!
|
||||
const canCointainer = (preferences === null || preferences === void 0 ? void 0 : preferences.enableContainerCurrency) && (rulesEngineConfig === null || rulesEngineConfig === void 0 ? void 0 : rulesEngineConfig.canUseCurrencyContainers);
|
||||
@@ -64,8 +57,9 @@ export function generateContainers(items, customItems, characterId, partyInfo, p
|
||||
});
|
||||
}
|
||||
const playerContainers = sortBy(itemContainers, (container) => getName(container));
|
||||
const sortedPartyContainers = sortBy(partyContainers, (container) => getName(container));
|
||||
return partyInventoryActive && partyEquipmentContainer
|
||||
? [equipmentContainer, ...playerContainers, partyEquipmentContainer, ...partyContainers]
|
||||
? [equipmentContainer, ...playerContainers, partyEquipmentContainer, ...sortedPartyContainers]
|
||||
: [equipmentContainer, ...playerContainers];
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -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