New source found from dndbeyond.com
This commit is contained in:
+11
-5
@@ -48,6 +48,7 @@ import {
|
||||
} from "../../../../../Shared/selectors/composite/apiCreator";
|
||||
import ClassManagerFeature from "../ClassManagerFeature";
|
||||
import { OptionalFeatureManager } from "../OptionalFeatureManager";
|
||||
import styles from "./styles.module.css";
|
||||
|
||||
interface Props {
|
||||
charClass: CharClass;
|
||||
@@ -69,7 +70,8 @@ interface Props {
|
||||
choiceType: any,
|
||||
choiceId: string,
|
||||
optionValue: number | null,
|
||||
parentChoiceId: string | null
|
||||
parentChoiceId: string | null,
|
||||
hasItemMappings: boolean
|
||||
) => void;
|
||||
onSpellPrepare: (spell: Spell, classMappingId: number) => void;
|
||||
onSpellUnprepare: (spell: Spell, classMappingId: number) => void;
|
||||
@@ -185,7 +187,8 @@ export default class ClassManager extends React.PureComponent<Props, State> {
|
||||
choiceId: string,
|
||||
choiceType: any,
|
||||
optionValue: number | null,
|
||||
parentChoiceId: string | null
|
||||
parentChoiceId: string | null,
|
||||
hasItemMappings: boolean
|
||||
): void => {
|
||||
const { onClassFeatureChoiceChange, charClass } = this.props;
|
||||
|
||||
@@ -196,7 +199,8 @@ export default class ClassManager extends React.PureComponent<Props, State> {
|
||||
choiceType,
|
||||
choiceId,
|
||||
optionValue,
|
||||
parentChoiceId
|
||||
parentChoiceId,
|
||||
hasItemMappings
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -420,8 +424,10 @@ export default class ClassManager extends React.PureComponent<Props, State> {
|
||||
levelsRemaining={levelsRemaining}
|
||||
/>
|
||||
<TabList
|
||||
variant="toggle"
|
||||
defaultActiveId={isMulticlass ? "none" : "features"}
|
||||
className={styles.tabList}
|
||||
variant="collapse"
|
||||
defaultActiveId="features"
|
||||
forceShow={!isMulticlass}
|
||||
tabs={[
|
||||
{
|
||||
label: "Class Features",
|
||||
|
||||
+11
-7
@@ -60,7 +60,8 @@ interface Props {
|
||||
choiceId: string,
|
||||
type: any,
|
||||
value: number | null,
|
||||
parentChoiceId: string | null
|
||||
parentChoiceId: string | null,
|
||||
hasItemMappings: boolean
|
||||
) => void;
|
||||
onInfusionChoiceItemChangePromise?: (
|
||||
infusionChoiceKey: string,
|
||||
@@ -163,7 +164,8 @@ export default class ClassManagerFeature extends React.PureComponent<
|
||||
id,
|
||||
type,
|
||||
HelperUtils.parseInputInt(value),
|
||||
parentChoiceId
|
||||
parentChoiceId,
|
||||
ClassFeatureUtils.getHasItemMappings(feature)
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -232,14 +234,15 @@ export default class ClassManagerFeature extends React.PureComponent<
|
||||
};
|
||||
|
||||
getChoiceCount = (): number => {
|
||||
const { feature } = this.props;
|
||||
return ClassFeatureUtils.getChoices(feature).length;
|
||||
const { feature, isActive } = this.props;
|
||||
return isActive ? ClassFeatureUtils.getChoices(feature).length : 0;
|
||||
};
|
||||
|
||||
getTodoChoiceCount = (): number => {
|
||||
const { feature } = this.props;
|
||||
return ClassFeatureUtils.getChoices(feature).filter(ChoiceUtils.isTodo)
|
||||
.length;
|
||||
const { feature, isActive } = this.props;
|
||||
return ClassFeatureUtils.getChoices(feature).filter(
|
||||
(feature) => isActive && ChoiceUtils.isTodo(feature)
|
||||
).length;
|
||||
};
|
||||
|
||||
getTotalChoiceCount = (): number => {
|
||||
@@ -390,6 +393,7 @@ export default class ClassManagerFeature extends React.PureComponent<
|
||||
<FeatureChoices
|
||||
choices={ClassFeatureUtils.getChoices(feature)}
|
||||
charClass={charClass}
|
||||
classFeature={feature}
|
||||
onChoiceChange={this.handleChoiceChange}
|
||||
shouldFetch={collapsibleOpened}
|
||||
/>
|
||||
|
||||
+92
-88
@@ -2,6 +2,7 @@ import React from "react";
|
||||
import { useContext } from "react";
|
||||
import { DispatchProp } from "react-redux";
|
||||
import { NavigateFunction, useNavigate } from "react-router-dom";
|
||||
import { AnyAction } from "redux";
|
||||
|
||||
import {
|
||||
ApiAdapterPromise,
|
||||
@@ -68,7 +69,6 @@ import {
|
||||
} from "../../../../Shared/selectors/composite/apiCreator";
|
||||
import { AppNotificationUtils } from "../../../../Shared/utils";
|
||||
import Page from "../../../components/Page";
|
||||
import { PageBody } from "../../../components/PageBody";
|
||||
import { navigationConfig } from "../../../config";
|
||||
import { ProgressionManager } from "../../ProgressionManager";
|
||||
import ConnectedBuilderPage from "../ConnectedBuilderPage";
|
||||
@@ -84,7 +84,9 @@ function getClassSpellList(
|
||||
return foundClassSpellList ? foundClassSpellList : null;
|
||||
}
|
||||
|
||||
interface Props extends DispatchProp {
|
||||
// TODO: We are typing with AnyAction here to work around issues with UnknownAction, the type that was introduced in Redux 5.
|
||||
// If we decide to modernize to Redux 5, we will need to refactor much of the Rules Engine redux usage.
|
||||
interface Props extends DispatchProp<AnyAction> {
|
||||
ruleData: RuleData;
|
||||
overallSpellInfo: OverallSpellInfo;
|
||||
prerequisiteData: PrerequisiteData;
|
||||
@@ -859,9 +861,10 @@ class ClassesManage extends React.PureComponent<Props> {
|
||||
choiceType: any,
|
||||
choiceId: string,
|
||||
optionValue: number | null,
|
||||
parentChoiceId: string | null
|
||||
parentChoiceId: string | null,
|
||||
hasItemMappings: boolean
|
||||
): void => {
|
||||
const { dispatch } = this.props;
|
||||
const { dispatch, inventoryManager } = this.props;
|
||||
dispatch(
|
||||
characterActions.classFeatureChoiceSetRequest(
|
||||
classId,
|
||||
@@ -869,7 +872,10 @@ class ClassesManage extends React.PureComponent<Props> {
|
||||
choiceType,
|
||||
choiceId,
|
||||
optionValue,
|
||||
parentChoiceId
|
||||
parentChoiceId,
|
||||
hasItemMappings
|
||||
? inventoryManager.handleAcceptOnSuccess(true)
|
||||
: undefined
|
||||
)
|
||||
);
|
||||
};
|
||||
@@ -900,7 +906,7 @@ class ClassesManage extends React.PureComponent<Props> {
|
||||
navigate(
|
||||
navigationConfig
|
||||
.getRouteDefPath(RouteKey.CLASS_CHOOSE)
|
||||
.replace(":characterId", characterId)
|
||||
.replace(":characterId", characterId.toString())
|
||||
);
|
||||
};
|
||||
|
||||
@@ -943,90 +949,88 @@ class ClassesManage extends React.PureComponent<Props> {
|
||||
|
||||
return (
|
||||
<Page clsNames={["classes-manage"]}>
|
||||
<PageBody>
|
||||
<div className="classes-manage-primary">
|
||||
<div className="classes-manage-primary-section classes-manage-primary-section-progression">
|
||||
<ProgressionManager />
|
||||
</div>
|
||||
<HpSummary />
|
||||
<div className="classes-manage-primary">
|
||||
<div className="classes-manage-primary-section classes-manage-primary-section-progression">
|
||||
<ProgressionManager />
|
||||
</div>
|
||||
{classes.map((charClass) => (
|
||||
<ClassManager
|
||||
theme={theme}
|
||||
charClass={charClass}
|
||||
loadAvailableFeats={loadAvailableFeats}
|
||||
loadAvailableSubclasses={loadAvailableSubclasses}
|
||||
loadRemainingSpellList={makeLoadClassRemainingSpells(charClass)}
|
||||
loadAlwaysKnownSpells={makeLoadClassAlwaysKnownSpells(charClass)}
|
||||
loadAvailableOptionalClassFeatures={loadAvailableOptionalClassFeatures(
|
||||
charClass
|
||||
)}
|
||||
loadAvailableInfusions={loadAvailableInfusions}
|
||||
levelsRemaining={levelsRemaining}
|
||||
onClassFeatureChoiceChange={this.handleClassFeatureChoiceChange}
|
||||
onSpellPrepare={this.handlePrepare}
|
||||
onSpellUnprepare={this.handleUnprepare}
|
||||
onSpellRemove={this.handleRemove}
|
||||
onSpellAdd={this.handleSpellAdd.bind(this, charClass)}
|
||||
onAlwaysKnownLoad={this.handleAlwaysKnownLoad}
|
||||
onInfusionChoiceItemChangePromise={
|
||||
this.handleInfusionChoiceItemChangePromise
|
||||
}
|
||||
onInfusionChoiceItemDestroyPromise={
|
||||
this.handleInfusionChoiceItemDestroyPromise
|
||||
}
|
||||
onInfusionChoiceChangePromise={
|
||||
this.handleInfusionChoiceChangePromise
|
||||
}
|
||||
onInfusionChoiceDestroyPromise={
|
||||
this.handleInfusionChoiceDestroyPromise
|
||||
}
|
||||
onInfusionChoiceCreatePromise={
|
||||
this.handleInfusionChoiceCreatePromise
|
||||
}
|
||||
onOptionalFeatureSelection={this.handleOptionalFeatureSelection}
|
||||
onRemoveSelectionPromise={
|
||||
this.handleRemoveOptionalFeatureSelectionPromise
|
||||
}
|
||||
onChangeReplacementPromise={
|
||||
this.handleOnChangeOptionalClassFeatureReplacementPromise
|
||||
}
|
||||
onDefinitionsLoaded={this.handleDefinitionsLoaded}
|
||||
onFeatureDefinitionsLoaded={this.handleFeatureDefinitionsLoaded}
|
||||
key={charClass.id}
|
||||
isMulticlass={classes.length > 1}
|
||||
choiceInfo={choiceInfo}
|
||||
preferences={preferences}
|
||||
classSpellList={getClassSpellList(charClass, classSpellLists)}
|
||||
spellCasterInfo={spellCasterInfo}
|
||||
ruleData={ruleData}
|
||||
overallSpellInfo={overallSpellInfo}
|
||||
prerequisiteData={prerequisiteData}
|
||||
typeValueLookup={typeValueLookup}
|
||||
globalModifiers={globalModifiers}
|
||||
definitionPool={definitionPool}
|
||||
featLookup={featLookup}
|
||||
knownInfusionLookup={knownInfusionLookup}
|
||||
knownReplicatedItems={knownReplicatedItems}
|
||||
dataOriginRefData={dataOriginRefData}
|
||||
optionalClassFeatureLookup={optionalClassFeatureLookup}
|
||||
classSpellListSpellsLookup={classSpellListSpellsLookup}
|
||||
activeSourceCategories={activeSourceCategories}
|
||||
inventoryManager={inventoryManager}
|
||||
entityRestrictionData={entityRestrictionData}
|
||||
/>
|
||||
))}
|
||||
{levelsRemaining !== 0 && (
|
||||
<div className="classes-manage-actions">
|
||||
<div
|
||||
className="classes-manage-actions-action"
|
||||
onClick={this.handleAddAnotherClass}
|
||||
>
|
||||
+ Add Another Class
|
||||
</div>
|
||||
<HpSummary />
|
||||
</div>
|
||||
{classes.map((charClass) => (
|
||||
<ClassManager
|
||||
theme={theme}
|
||||
charClass={charClass}
|
||||
loadAvailableFeats={loadAvailableFeats}
|
||||
loadAvailableSubclasses={loadAvailableSubclasses}
|
||||
loadRemainingSpellList={makeLoadClassRemainingSpells(charClass)}
|
||||
loadAlwaysKnownSpells={makeLoadClassAlwaysKnownSpells(charClass)}
|
||||
loadAvailableOptionalClassFeatures={loadAvailableOptionalClassFeatures(
|
||||
charClass
|
||||
)}
|
||||
loadAvailableInfusions={loadAvailableInfusions}
|
||||
levelsRemaining={levelsRemaining}
|
||||
onClassFeatureChoiceChange={this.handleClassFeatureChoiceChange}
|
||||
onSpellPrepare={this.handlePrepare}
|
||||
onSpellUnprepare={this.handleUnprepare}
|
||||
onSpellRemove={this.handleRemove}
|
||||
onSpellAdd={this.handleSpellAdd.bind(this, charClass)}
|
||||
onAlwaysKnownLoad={this.handleAlwaysKnownLoad}
|
||||
onInfusionChoiceItemChangePromise={
|
||||
this.handleInfusionChoiceItemChangePromise
|
||||
}
|
||||
onInfusionChoiceItemDestroyPromise={
|
||||
this.handleInfusionChoiceItemDestroyPromise
|
||||
}
|
||||
onInfusionChoiceChangePromise={
|
||||
this.handleInfusionChoiceChangePromise
|
||||
}
|
||||
onInfusionChoiceDestroyPromise={
|
||||
this.handleInfusionChoiceDestroyPromise
|
||||
}
|
||||
onInfusionChoiceCreatePromise={
|
||||
this.handleInfusionChoiceCreatePromise
|
||||
}
|
||||
onOptionalFeatureSelection={this.handleOptionalFeatureSelection}
|
||||
onRemoveSelectionPromise={
|
||||
this.handleRemoveOptionalFeatureSelectionPromise
|
||||
}
|
||||
onChangeReplacementPromise={
|
||||
this.handleOnChangeOptionalClassFeatureReplacementPromise
|
||||
}
|
||||
onDefinitionsLoaded={this.handleDefinitionsLoaded}
|
||||
onFeatureDefinitionsLoaded={this.handleFeatureDefinitionsLoaded}
|
||||
key={charClass.id}
|
||||
isMulticlass={classes.length > 1}
|
||||
choiceInfo={choiceInfo}
|
||||
preferences={preferences}
|
||||
classSpellList={getClassSpellList(charClass, classSpellLists)}
|
||||
spellCasterInfo={spellCasterInfo}
|
||||
ruleData={ruleData}
|
||||
overallSpellInfo={overallSpellInfo}
|
||||
prerequisiteData={prerequisiteData}
|
||||
typeValueLookup={typeValueLookup}
|
||||
globalModifiers={globalModifiers}
|
||||
definitionPool={definitionPool}
|
||||
featLookup={featLookup}
|
||||
knownInfusionLookup={knownInfusionLookup}
|
||||
knownReplicatedItems={knownReplicatedItems}
|
||||
dataOriginRefData={dataOriginRefData}
|
||||
optionalClassFeatureLookup={optionalClassFeatureLookup}
|
||||
classSpellListSpellsLookup={classSpellListSpellsLookup}
|
||||
activeSourceCategories={activeSourceCategories}
|
||||
inventoryManager={inventoryManager}
|
||||
entityRestrictionData={entityRestrictionData}
|
||||
/>
|
||||
))}
|
||||
{levelsRemaining !== 0 && (
|
||||
<div className="classes-manage-actions">
|
||||
<div
|
||||
className="classes-manage-actions-action"
|
||||
onClick={this.handleAddAnotherClass}
|
||||
>
|
||||
+ Add Another Class
|
||||
</div>
|
||||
)}
|
||||
</PageBody>
|
||||
</div>
|
||||
)}
|
||||
</Page>
|
||||
);
|
||||
}
|
||||
|
||||
+4
-4
@@ -291,7 +291,7 @@ export class OptionalFeatureManager extends React.PureComponent<
|
||||
contentNode = (
|
||||
<div className="ct-optional-feature-manager__content">
|
||||
{replacementFeatures.length > 0 && (
|
||||
<React.Fragment>
|
||||
<>
|
||||
<PageSubHeader>Replacement Features</PageSubHeader>
|
||||
{ClassUtils.deriveOrderedClassFeatures(replacementFeatures).map(
|
||||
(feature) => {
|
||||
@@ -332,10 +332,10 @@ export class OptionalFeatureManager extends React.PureComponent<
|
||||
);
|
||||
}
|
||||
)}
|
||||
</React.Fragment>
|
||||
</>
|
||||
)}
|
||||
{additionalFeatures.length > 0 && (
|
||||
<React.Fragment>
|
||||
<>
|
||||
<PageSubHeader>Additional Features</PageSubHeader>
|
||||
{ClassUtils.deriveOrderedClassFeatures(additionalFeatures).map(
|
||||
(feature) => {
|
||||
@@ -376,7 +376,7 @@ export class OptionalFeatureManager extends React.PureComponent<
|
||||
);
|
||||
}
|
||||
)}
|
||||
</React.Fragment>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import OptionalFeatureManager from "./OptionalFeatureManager";
|
||||
|
||||
export default OptionalFeatureManager;
|
||||
export { OptionalFeatureManager };
|
||||
Reference in New Issue
Block a user