New source found from dndbeyond.com
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { characterActions, serviceDataActions } from '../actions';
|
||||
import { ConfigUtils } from '../config';
|
||||
import { rulesEngineConfig } from '../config/utils';
|
||||
import { ContainerAccessors } from '../engine/Container';
|
||||
import { ContainerAccessors, ContainerValidators } from '../engine/Container';
|
||||
import { CoreUtils, CURRENCY_VALUE } from '../engine/Core';
|
||||
import { DefinitionHacks } from '../engine/Definition';
|
||||
import { FormatUtils } from '../engine/Format';
|
||||
@@ -22,6 +22,7 @@ export class CoinManager extends InventoryManager {
|
||||
if (!isEmpty && container) {
|
||||
const destinationEntityTypeId = ContainerAccessors.getContainerType(container);
|
||||
const destinationEntityId = ContainerAccessors.getMappingId(container);
|
||||
const isDestinationContainerShared = ContainerValidators.validateIsShared(DefinitionHacks.hack__generateDefinitionKey(destinationEntityTypeId, destinationEntityId), containerLookup);
|
||||
const currentCoins = this.getContainerCoin(containerDefinitionKey);
|
||||
if (multiplier === 1) {
|
||||
const validAddCoin = this.calculateAddCoinPayload(currentCoins, coin.cp || 0, coin.ep || 0, coin.gp || 0, coin.pp || 0, coin.sp || 0);
|
||||
@@ -39,6 +40,11 @@ export class CoinManager extends InventoryManager {
|
||||
}
|
||||
this.dispatch(characterActions.currencyTransactionSet(Object.assign(Object.assign({}, adjustedCurrency), { destinationEntityId: destinationEntityId, destinationEntityTypeId: destinationEntityTypeId }), () => {
|
||||
typeof onSuccess === 'function' && onSuccess();
|
||||
if (isDestinationContainerShared) {
|
||||
const data = {};
|
||||
const eventType = this.EVENT_TYPES.ITEM_SHARED_FULFILLED;
|
||||
this.sendMessage({ data, eventType });
|
||||
}
|
||||
}, () => {
|
||||
typeof onError === 'function' && onError();
|
||||
}));
|
||||
@@ -238,25 +244,6 @@ export class CoinManager extends InventoryManager {
|
||||
}
|
||||
};
|
||||
// Validators
|
||||
this.canAddCoin = (coin, containerDefinitionKey) => {
|
||||
const containerLookup = rulesEngineSelectors.getContainerLookup(this.state);
|
||||
const container = HelperUtils.lookupDataOrFallback(containerLookup, containerDefinitionKey);
|
||||
const isShared = container ? ContainerAccessors.isShared(container) : false;
|
||||
if (isShared && this.isSharingTurnedDeleteOnly()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
this.canRemoveCoin = (coin, containerDefinitionKey) => {
|
||||
const containerLookup = rulesEngineSelectors.getContainerLookup(this.state);
|
||||
const container = HelperUtils.lookupDataOrFallback(containerLookup, containerDefinitionKey);
|
||||
const isShared = container ? ContainerAccessors.isShared(container) : false;
|
||||
if (isShared && this.isSharingTurnedDeleteOnly()) {
|
||||
let hasNegatives = Object.values(coin).some((value) => value < 0);
|
||||
return !hasNegatives;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
this.canUseCointainers = () => {
|
||||
const rulesEngineConfig = ConfigUtils.getCurrentRulesEngineConfig();
|
||||
const preferences = rulesEngineSelectors.getPreferences(this.state);
|
||||
|
||||
Reference in New Issue
Block a user