Added several phase 3 functions

This commit is contained in:
Lukas Obermann
2016-10-25 03:29:35 +02:00
parent 7c905323e5
commit b0ea6309ce
35 changed files with 653 additions and 413 deletions
+3 -2
View File
@@ -57,13 +57,14 @@
display: flex;
flex-wrap: wrap;
> div:not(.btn):not(.iconbutton):not(.textfield):not(.dropdown), > h2, > h3, > h4, > ul {
> div:not(.btn):not(.btn-icon):not(.textfield):not(.dropdown), > h2, > h3, > h4, > ul {
flex: 1 0 auto;
width: 100%;
margin-top: 20px;
}
.textfield, .dropdown {
+ .iconbutton {
+ .btn-icon {
margin: 10px 0 10px 11px;
}
}
@@ -54,7 +54,7 @@
}
}
> .iconbutton {
> .btn-icon {
margin-top: 5px;
}
+2 -2
View File
@@ -33,7 +33,7 @@
margin-top: 0;
text-decoration: none;
&.primary {
&.btn-primary {
border-image: linear-gradient(to bottom, #0abdb7 0%, #0abdb7 60%, #0c4550 100%) 1 1 1 1;
color: #a3c7c7;
background-color: transparentize(#101721, .5);
@@ -64,7 +64,7 @@
&.disabled {
pointer-events: none;
border-color: #2b2f34 !important;
background: transparent !important;
background: none !important;
color: #31353a !important;
border-image: none !important;
box-shadow: none;
+2 -2
View File
@@ -1,4 +1,4 @@
.iconbutton {
.btn-icon {
width: 32px;
height: 32px;
color: #c8aa6e;
@@ -24,7 +24,7 @@
}
}
&.primary {
&.btn-primary {
background: linear-gradient(to bottom, #0abdb7 0%, #0abdb7 60%, #0c4550 100%);
color: #a3c7c7;
+390 -259
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
File diff suppressed because one or more lines are too long
+5
View File
@@ -63,6 +63,11 @@ var ProfileActions = {
AppDispatcher.dispatch({
actionType: ActionTypes.REROLL_WEIGHT
});
},
endCharacterCreation: function() {
AppDispatcher.dispatch({
actionType: ActionTypes.FINALIZE_CHARACTER_CREATION
});
}
};
+1
View File
@@ -174,6 +174,7 @@ var ServerActions = {
},
loadHeroSuccess: function(id, data) {
var short = HerolistStore.get(id);
data = JSON.parse(data);
AppDispatcher.dispatch({
actionType: ActionTypes.RECEIVE_HERO,
...(Object.assign({}, short, data))
+13 -8
View File
@@ -2,6 +2,7 @@ import AttributeCalc from './AttributeCalc';
import AttributeList from './AttributeList';
import AttributeStore from '../../../stores/AttributeStore';
import ELStore from '../../../stores/ELStore';
import PhaseStore from '../../../stores/PhaseStore';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
@@ -10,40 +11,44 @@ class Attribute extends Component {
state = {
attributes: AttributeStore.getAllForView(),
baseValues: AttributeStore.getBaseValues(),
phase: PhaseStore.get(),
sum: AttributeStore.getSum()
};
constructor(props) {
super(props);
}
_updateAttributeStore = () => this.setState({
attributes: AttributeStore.getAllForView(),
baseValues: AttributeStore.getBaseValues(),
sum: AttributeStore.getSum()
});
_updatePhaseStore = () => this.setState({
phase: PhaseStore.get()
});
componentDidMount() {
AttributeStore.addChangeListener(this._updateAttributeStore);
PhaseStore.addChangeListener(this._updatePhaseStore );
}
componentWillUnmount() {
AttributeStore.removeChangeListener(this._updateAttributeStore);
PhaseStore.removeChangeListener(this._updatePhaseStore );
}
render() {
const { baseValues, sum, ...other } = this.state;
const START_EL = ELStore.getStart();
const sumMax = this.state.sum >= START_EL.max_attrsum;
const sumMax = sum >= START_EL.max_attrsum;
const max = START_EL.max_attr;
const element = this.state.attributes.length === 8 ? (
<section id="attribute">
<div className="page">
<Scroll>
<div className="counter">Punkte in Eigenschaften: {this.state.sum}</div>
<AttributeList attributes={this.state.attributes} max={max} sumMax={sumMax} />
<AttributeCalc attributes={this.state.attributes} baseValues={this.state.baseValues} />
<div className="counter">Punkte in Eigenschaften: {sum}</div>
<AttributeList {...other} max={max} sumMax={sumMax} />
<AttributeCalc {...other} baseValues={baseValues} />
</Scroll>
</div>
</section>
@@ -12,10 +12,6 @@ class AttributeBorder extends Component {
])
};
constructor(props) {
super(props);
}
render() {
const className = classNames( 'attr', this.props.className );
@@ -7,16 +7,13 @@ class AttributeCalc extends Component {
static propTypes = {
attributes: PropTypes.array.isRequired,
baseValues: PropTypes.object.isRequired
baseValues: PropTypes.object.isRequired,
phase: PropTypes.number.isRequired
};
constructor(props) {
super(props);
}
render() {
const { attributes, baseValues } = this.props;
const { attributes, baseValues, phase } = this.props;
const calculated = [
{
@@ -124,7 +121,13 @@ class AttributeCalc extends Component {
return (
<div className="calculated">
{
calculated.map(attribute => <AttributeCalcItem key={attribute.label} attribute={attribute} />)
calculated.map(attribute => (
<AttributeCalcItem
key={attribute.label}
attribute={attribute}
phase={phase}
/>
))
}
</div>
);
@@ -6,28 +6,25 @@ import React, { Component, PropTypes } from 'react';
class AttributeCalcItem extends Component {
static propTypes = {
attribute: PropTypes.object.isRequired
attribute: PropTypes.object.isRequired,
phase: PropTypes.number.isRequired
};
constructor(props) {
super(props);
}
addMaxEnergyPoint = () => AttributeActions.addMaxEnergyPoint(this.props.attribute.label);
render() {
const { disabledIncrease, disabledPermanent, ...other } = this.props.attribute;
const { attribute : { disabledIncrease, disabledPermanent, ...other }, phase } = this.props;
const increaseElement = this.props.attribute.hasOwnProperty('disabledIncrease') && other.value !== '-' ? (
const increaseElement = this.props.attribute.hasOwnProperty('disabledIncrease') && other.value !== '-' && phase > 2 ? (
<IconButton className="add" icon="&#xE145;" onClick={this.addMaxEnergyPoint} disabled={disabledIncrease} />
) : null;
const rebuyElement = this.props.attribute.hasOwnProperty('disabledPermanent') && other.value !== '-' ? (
const rebuyElement = this.props.attribute.hasOwnProperty('disabledPermanent') && other.value !== '-' && phase > 2 ? (
<IconButton className="rebuy" icon="&#xE923;" disabled={disabledPermanent} />
) : null;
const rebuyUndoElement = this.props.attribute.hasOwnProperty('disabledPermanent') && other.value !== '-' ? (
const rebuyUndoElement = this.props.attribute.hasOwnProperty('disabledPermanent') && other.value !== '-' && phase > 2 ? (
<IconButton className="rebuy-undo" icon="&#xE8B3;" disabled={disabledPermanent} />
) : null;
@@ -6,13 +6,10 @@ class AttributeList extends Component {
static propTypes = {
attributes: PropTypes.array.isRequired,
max: PropTypes.number.isRequired,
phase: PropTypes.number.isRequired,
sumMax: PropTypes.bool.isRequired
};
constructor(props) {
super(props);
}
render() {
const { attributes, ...other } = this.props;
@@ -6,24 +6,23 @@ import React, { Component, PropTypes } from 'react';
class AttributeListItem extends Component {
static propTypes = {
attribute: PropTypes.object.isRequired
attribute: PropTypes.object.isRequired,
phase: PropTypes.number.isRequired
};
constructor(props) {
super(props);
}
addPoint = () => AttributeActions.addPoint(this.props.attribute.id);
removePoint = () => AttributeActions.removePoint(this.props.attribute.id);
render() {
const { id, short, value, disabledIncrease, disabledDecrease } = this.props.attribute;
const { attribute: { id, short, value, disabledIncrease, disabledDecrease }, phase } = this.props;
return (
<AttributeBorder className={id} label={short} value={value}>
<IconButton className="add" icon="&#xE145;" onClick={this.addPoint} disabled={disabledIncrease} />
<IconButton className="remove" icon="&#xE15B;" onClick={this.removePoint} disabled={disabledDecrease} />
{ phase < 3 ? (
<IconButton className="remove" icon="&#xE15B;" onClick={this.removePoint} disabled={disabledDecrease} />
) : null }
</AttributeBorder>
);
}
@@ -63,7 +63,6 @@ class DisAdvAddListItem extends Component {
var inputElement2;
if (['ADV_4','ADV_16','ADV_17','ADV_47','DISADV_48'].indexOf(disadv.id) > -1) {
console.log(disadv.sel);
if (this.state.selected !== '') {
ap = disadv.ap[DisAdvStore.get(this.state.selected).skt - 1];
}
+31 -9
View File
@@ -1,5 +1,6 @@
import Avatar from '../../layout/Avatar';
import APStore from '../../../stores/APStore';
import BorderButton from '../../layout/BorderButton';
import CultureStore from '../../../stores/rcp/CultureStore';
import DisAdvStore from '../../../stores/DisAdvStore';
import Dropdown from '../../layout/Dropdown';
@@ -10,6 +11,7 @@ import OverviewNameChange from './OverviewNameChange';
import ProfessionStore from '../../../stores/rcp/ProfessionStore';
import ProfessionVariantStore from '../../../stores/rcp/ProfessionVariantStore';
import RaceStore from '../../../stores/rcp/RaceStore';
import PhaseStore from '../../../stores/PhaseStore';
import ProfileActions from '../../../actions/ProfileActions';
import ProfileStore from '../../../stores/ProfileStore';
import React, { Component } from 'react';
@@ -28,13 +30,10 @@ class Overview extends Component {
eyes: ProfileStore.getEyes(),
size: ProfileStore.getSize(),
weight: ProfileStore.getWeight(),
phase: PhaseStore.get(),
showImageUpload: false,
editName: false
};
constructor(props) {
super(props);
}
_updateProfileStore = () => this.setState({
name: ProfileStore.getName(),
@@ -45,6 +44,9 @@ class Overview extends Component {
size: ProfileStore.getSize(),
weight: ProfileStore.getWeight()
});
_updatePhaseStore = () => this.setState({
phase: PhaseStore.get()
});
showImageUpload = () => ProfileActions.showImageUpload();
changeName = name => {
@@ -61,18 +63,21 @@ class Overview extends Component {
rerollEyes = () => ProfileActions.rerollEyes();
rerollSize = () => ProfileActions.rerollSize();
rerollWeight = () => ProfileActions.rerollWeight();
endCharacterCreation = () => ProfileActions.endCharacterCreation();
componentDidMount() {
PhaseStore.addChangeListener(this._updatePhaseStore );
ProfileStore.addChangeListener(this._updateProfileStore );
}
componentWillUnmount() {
PhaseStore.removeChangeListener(this._updatePhaseStore );
ProfileStore.removeChangeListener(this._updateProfileStore );
}
render() {
const { editName, name, portrait, hair, eyes, size, weight } = this.state;
const { editName, name, portrait, hair, eyes, size, weight, phase } = this.state;
const hairArr = RaceStore.getCurrent() ? [
['blauschwarz',1],
@@ -198,10 +203,27 @@ class Overview extends Component {
onChange={this.changeWeight}
/>
<IconButton icon="&#xE863;" onClick={this.rerollWeight} />
<h3>Vorteile</h3>
<OverviewDisAdv list={this.state.advActive} />
<h3>Nachteile</h3>
<OverviewDisAdv list={this.state.disadvActive} />
{
phase === 2 ? (
<div>
<BorderButton
label="Heldenerstellung beenden"
onClick={this.endCharacterCreation}
primary
/>
</div>
) : null
}
{
phase === 3 ? (
<div>
<h3>Vorteile</h3>
<OverviewDisAdv list={this.state.advActive} />
<h3>Nachteile</h3>
<OverviewDisAdv list={this.state.disadvActive} />
</div>
) : null
}
</Scroll>
</div>
);
+18 -5
View File
@@ -1,4 +1,5 @@
import Overview from './Overview';
import PhaseStore from '../../../stores/PhaseStore';
import React, { Component } from 'react';
import Sheets from './Sheets';
import SubTabs from '../../layout/SubTabs';
@@ -6,20 +7,31 @@ import SubTabs from '../../layout/SubTabs';
class Profile extends Component {
state = {
phase: PhaseStore.get(),
tab: 'overview'
};
constructor(props) {
super(props);
}
_updatePhaseStore = () => this.setState({
phase: PhaseStore.get()
});
handleClick = tab => this.setState({ tab });
componentDidMount() {
PhaseStore.addChangeListener(this._updatePhaseStore );
}
componentWillUnmount() {
PhaseStore.removeChangeListener(this._updatePhaseStore );
}
render() {
const { phase, tab } = this.state;
var element;
switch (this.state.tab) {
switch (tab) {
case 'overview':
element = <Overview />;
break;
@@ -43,7 +55,8 @@ class Profile extends Component {
// },
{
label: 'Heldenbogen',
tag: 'sheets'
tag: 'sheets',
disabled: phase < 3
}
]}
active={this.state.tab}
@@ -1,9 +1,11 @@
import BorderButton from '../../layout/BorderButton';
import CombatTechniquesActions from '../../../actions/CombatTechniquesActions';
import CombatTechniquesStore from '../../../stores/CombatTechniquesStore';
import PhaseStore from '../../../stores/PhaseStore';
import RadioButtonGroup from '../../layout/RadioButtonGroup';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
import SkillListItem from './SkillListItem';
import TextField from '../../layout/TextField';
class CombatTechniques extends Component {
@@ -11,7 +13,8 @@ class CombatTechniques extends Component {
state = {
combattech: CombatTechniquesStore.getAllForView(),
filter: CombatTechniquesStore.getFilter(),
sortOrder: CombatTechniquesStore.getSortOrder()
sortOrder: CombatTechniquesStore.getSortOrder(),
phase: PhaseStore.get()
};
constructor(props) {
@@ -82,19 +85,22 @@ class CombatTechniques extends Component {
this.state.combattech.map(ct => {
const leit = ct.leit.map(attr => ATTR[attr]).join('/');
return (
<tr key={ct.id}>
<td className="type">{GR[ct.gr - 1]}</td>
<td className="name"><h2>{ct.name}</h2></td>
<td className="fw">{ct.fw}</td>
<SkillListItem
key={ct.id}
group={GR[ct.gr - 1]}
name={ct.name}
fw={ct.fw}
skt={ct.skt}
checkDisabled
addPoint={this.addPoint.bind(null, ct.id)}
addDisabled={ct.disabledIncrease}
removePoint={this.state.phase < 3 ? this.removePoint.bind(null, ct.id) : undefined}
removeDisabled={ct.disabledDecrease}
>
<td className="leit">{leit}</td>
<td className="at">{ct.at}</td>
<td className="pa">{ct.gr == 2 ? '--' : ct.pa}</td>
<td className="skt">{COMP[ct.skt - 1]}</td>
<td className="inc">
<BorderButton label="+" onClick={this.addPoint.bind(null, ct.id)} disabled={ct.disabledIncrease} />
<BorderButton label="-" onClick={this.removePoint.bind(null, ct.id)} disabled={ct.disabledDecrease} />
</td>
</tr>
</SkillListItem>
);
})
}
+3 -1
View File
@@ -1,6 +1,7 @@
import BorderButton from '../../layout/BorderButton';
import LiturgiesActions from '../../../actions/LiturgiesActions';
import LiturgiesStore from '../../../stores/LiturgiesStore';
import PhaseStore from '../../../stores/PhaseStore';
import RadioButtonGroup from '../../layout/RadioButtonGroup';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
@@ -16,6 +17,7 @@ class Liturgies extends Component {
addChantsDisabled: LiturgiesStore.isActivationDisabled(),
filter: LiturgiesStore.getFilter(),
sortOrder: LiturgiesStore.getSortOrder(),
phase: PhaseStore.get(),
showAddSlidein: false
};
@@ -175,7 +177,7 @@ class Liturgies extends Component {
key={liturgy.id}
group={GR[liturgy.gr - 1]}
name={name}
removePoint={this.removePoint.bind(null, liturgy.id)}
removePoint={this.state.phase < 3 ? this.removePoint.bind(null, liturgy.id) : undefined}
removeDisabled={liturgy.disabledDecrease}
{...obj} >
<td className="aspc">{aspc}</td>
@@ -12,6 +12,7 @@ class SkillListItem extends Component {
fw: PropTypes.number,
children: PropTypes.node,
check: PropTypes.array,
checkDisabled: PropTypes.bool,
checkmod: PropTypes.string,
skt: PropTypes.number,
isNotActive: PropTypes.bool,
@@ -29,7 +30,7 @@ class SkillListItem extends Component {
render() {
const { typ, untyp, group, name, fw, children, check, checkmod, skt, isNotActive, activate, activateDisabled, addPoint, addDisabled, removePoint, removeDisabled } = this.props;
const { typ, untyp, group, name, fw, children, check, checkDisabled, checkmod, skt, isNotActive, activate, activateDisabled, addPoint, addDisabled, removePoint, removeDisabled } = this.props;
const className = classNames({
'typ': typ,
@@ -57,9 +58,9 @@ class SkillListItem extends Component {
ATTR_8: 'KK'
};
const checkElement = (
const checkElement = !checkDisabled ? (
<td className="check">{check ? `${check.map(attr => ATTR[attr]).join('/')} ${checkmod ? `(+${checkmod})` : ''}` : null}</td>
);
) : null;
const COMP = ['A', 'B', 'C', 'D', 'E'];
@@ -78,7 +79,7 @@ class SkillListItem extends Component {
) : (
<td className="inc">
{ addPoint ? <BorderButton label="+" onClick={addPoint} disabled={addDisabled} /> : null }
<BorderButton label="-" onClick={removePoint} disabled={removeDisabled} />
{ removePoint ? <BorderButton label="-" onClick={removePoint} disabled={removeDisabled} /> : null }
</td>
);
@@ -1,5 +1,6 @@
import BorderButton from '../../layout/BorderButton';
import Dropdown from '../../layout/Dropdown';
import PhaseStore from '../../../stores/PhaseStore';
import RadioButtonGroup from '../../layout/RadioButtonGroup';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
@@ -17,6 +18,7 @@ class SpecialAbilities extends Component {
saDeactive: SpecialAbilitiesStore.getDeactiveForView(),
filter: SpecialAbilitiesStore.getFilter(),
sortOrder: SpecialAbilitiesStore.getSortOrder(),
phase: PhaseStore.get(),
showAddSlidein: false
};
@@ -103,12 +105,14 @@ class SpecialAbilities extends Component {
<td className="type">Gruppe</td>
<td className="name">Sonderfertigkeit</td>
<td className="ap">AP</td>
<td className="inc"></td>
{ this.state.phase < 3 ? (
<td className="inc"></td>
) : null }
</tr>
</thead>
<tbody>
{
this.state.saActive.map((sa, index) => <SpecialAbilitiesListRemoveItem key={`SA_ACTIVE_${index}`} item={sa} />)
this.state.saActive.map((sa, index) => <SpecialAbilitiesListRemoveItem key={`SA_ACTIVE_${index}`} item={sa} phase={this.state.phase} />)
}
</tbody>
</table>
@@ -7,7 +7,8 @@ import TextField from '../../layout/TextField';
class SpecialAbilitiesListRemoveItem extends Component {
static propTypes = {
item: PropTypes.object
item: PropTypes.object,
phase: PropTypes.number
};
state = {
@@ -40,22 +41,29 @@ class SpecialAbilitiesListRemoveItem extends Component {
var name = item.name;
var tierElement;
var addSpecial;
var roman = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'];
if (item.tiers !== undefined && item.tiers !== null) {
var array = [];
if (item.id === 'SA_30') array.push(['MS', 4]);
if (item.id === 'SA_30' && (item.tier === 4 || this.props.phase < 3)) array.push(['MS', 4]);
for (let i = 0; i < item.tiers; i++ ) {
array.push([roman[i], i + 1]);
if (this.props.phase < 3 || i + 1 >= item.tier) {
array.push([roman[i], i + 1]);
}
}
if (array.length > 1) {
tierElement = (
<Dropdown
className="tiers"
value={item.tier}
onChange={this.handleSelectTier}
options={array} />
);
} else {
addSpecial = ' ' + array[0][0];
}
tierElement = (
<Dropdown
className="tiers"
value={item.tier}
onChange={this.handleSelectTier}
options={array} />
);
ap = item.tier === 4 && item.id === 'SA_30' ? 0 : item.ap * item.tier;
}
@@ -64,6 +72,7 @@ class SpecialAbilitiesListRemoveItem extends Component {
if (item.hasOwnProperty('sid')) args.sid = item.sid;
if (item.hasOwnProperty('add')) name += ` (${item.add})`;
if (addSpecial) name += addSpecial;
const GROUPS = ['Allgemein', 'Schicksal', 'Kampf', 'Magisch', 'Magisch (Stab)', 'Magisch (Hexe)', 'Geweiht'];
@@ -77,9 +86,11 @@ class SpecialAbilitiesListRemoveItem extends Component {
</div>
</td>
<td className="ap">{ap}</td>
<td className="inc">
<BorderButton label="-" onClick={this.removeFromList.bind(null, args)} disabled={disabled} />
</td>
{ this.props.phase < 3 ? (
<td className="inc">
<BorderButton label="-" onClick={this.removeFromList.bind(null, args)} disabled={disabled} />
</td>
) : null }
</tr>
);
}
+3 -1
View File
@@ -1,4 +1,5 @@
import BorderButton from '../../layout/BorderButton';
import PhaseStore from '../../../stores/PhaseStore';
import RadioButtonGroup from '../../layout/RadioButtonGroup';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
@@ -16,6 +17,7 @@ class Spells extends Component {
addSpellsDisabled: SpellsStore.isActivationDisabled(),
filter: SpellsStore.getFilter(),
sortOrder: SpellsStore.getSortOrder(),
phase: PhaseStore.get(),
showAddSlidein: false
};
@@ -181,7 +183,7 @@ class Spells extends Component {
key={spell.id}
group={GR[spell.gr - 1]}
name={name}
removePoint={this.removePoint.bind(null, spell.id)}
removePoint={this.state.phase < 3 ? this.removePoint.bind(null, spell.id) : undefined}
removeDisabled={spell.disabledDecrease}
{...obj} >
<td className="merk">{MERK[spell.merk - 1]}</td>
+7 -5
View File
@@ -1,6 +1,7 @@
import BorderButton from '../../layout/BorderButton';
import Checkbox from '../../layout/Checkbox';
import CultureStore from '../../../stores/rcp/CultureStore';
import PhaseStore from '../../../stores/PhaseStore';
import RadioButtonGroup from '../../layout/RadioButtonGroup';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
@@ -12,11 +13,12 @@ import TextField from '../../layout/TextField';
class Talents extends Component {
state = {
talents: TalentsStore.getAllForView(),
list: TalentsStore.getAllForView(),
filter: TalentsStore.getFilter(),
sortOrder: TalentsStore.getSortOrder(),
talentRating: TalentsStore.getTalentRating(),
currentCulture: CultureStore.getCurrent()
currentCulture: CultureStore.getCurrent(),
phase: PhaseStore.get()
};
constructor(props) {
@@ -24,7 +26,7 @@ class Talents extends Component {
}
_updateTalentsStore = () => this.setState({
talents: TalentsStore.getAllForView(),
list: TalentsStore.getAllForView(),
filter: TalentsStore.getFilter(),
sortOrder: TalentsStore.getSortOrder(),
talentRating: TalentsStore.getTalentRating()
@@ -82,7 +84,7 @@ class Talents extends Component {
</thead>
<tbody>
{
this.state.talents.map(talent => (
this.state.list.map(talent => (
<SkillListItem
key={talent.id}
typ={this.state.talentRating && typ_talents.indexOf(talent.id) > -1}
@@ -94,7 +96,7 @@ class Talents extends Component {
skt={talent.skt}
addPoint={this.addPoint.bind(null, talent.id)}
addDisabled={talent.disabledIncrease}
removePoint={this.removePoint.bind(null, talent.id)}
removePoint={this.state.phase < 3 ? this.removePoint.bind(null, talent.id) : undefined}
removeDisabled={talent.disabledDecrease} />
))
}
+1 -5
View File
@@ -11,13 +11,9 @@ class BorderButton extends Component {
label: PropTypes.string
};
constructor(props) {
super(props);
}
render() {
const className = classNames('btn', this.props.primary && 'primary', this.props.fullWidth && 'fullWidth', this.props.disabled && 'disabled', this.props.className);
const className = classNames('btn', this.props.primary && 'btn-primary', this.props.fullWidth && 'fullWidth', this.props.disabled && 'disabled', this.props.className);
const labelTextElement = this.props.label ? (
<span>{this.props.label}</span>
+1 -1
View File
@@ -17,7 +17,7 @@ class IconButton extends Component {
render() {
const className = classNames('iconbutton', this.props.primary && 'primary', this.props.disabled && 'disabled', this.props.className);
const className = classNames('btn-icon', this.props.primary && 'btn-primary', this.props.disabled && 'disabled', this.props.className);
return (
<div className={className} onClick={this.props.onClick}>
+1
View File
@@ -52,6 +52,7 @@ export default keyMirror({
// PhaseStore
INCREASE_PHASE: null,
RESET_PHASE: null,
FINALIZE_CHARACTER_CREATION: null,
// CharbaseStore
SET_RULES: null,
+1 -2
View File
@@ -129,8 +129,7 @@ var AttributeStore = Object.assign({}, EventEmitter.prototype, {
},
getAllForView: function() {
// var phase = PhaseStore.get();
var phase = 1;
var phase = PhaseStore.get();
var attrsObj = ListStore.getObjByCategory(CATEGORY);
var attrs = [];
+3 -4
View File
@@ -31,7 +31,7 @@ function _updateSortOrder(option) {
function _clear() {
ListStore.getAllByCategory(CATEGORY).forEach(e => {
ListStore.setSR(e.id, 0);
ListStore.setSR(e.id, 6);
ListStore.setProperty(e.id, 'dependencies', []);
});
}
@@ -105,8 +105,7 @@ var CombatTechniquesStore = Object.assign({}, EventEmitter.prototype, {
},
getAllForView: function() {
// var phase = PhaseStore.get();
var phase = 1;
var phase = PhaseStore.get();
var combatTechniquesObj = ListStore.getObjByCategory(CATEGORY);
var combatTechniques = [];
@@ -123,7 +122,7 @@ var CombatTechniquesStore = Object.assign({}, EventEmitter.prototype, {
if (phase < 3)
_max = ELStore.getStart().max_combattech + _max_bonus;
else {
let primary = leit.map(e => this.get(`ATTR_${e}`).value);
let primary = leit.map(e => ListStore.get(e).value);
_max = Math.max(...primary) + 2 + _max_bonus;
}
combatTechnique.disabledIncrease = fw >= _max;
+61 -15
View File
@@ -11,35 +11,68 @@ import reactAlert from '../utils/reactAlert';
import reqPurchase from '../utils/reqPurchase';
var _history = [];
var _lastSaveIndex = -1;
function _add(obj) {
_history.push(obj);
function _add(actionType, costs = 0, previousState = null, options) {
_history.push({
actionType,
costs,
previousState,
options
});
}
function _clear() {
_history = [];
}
function _resetSaveIndex() {
_lastSaveIndex = _history.length - 1;
}
function _updateAll(array) {
_history = array;
_lastSaveIndex = _history.length - 1;
}
function _assignRCP(selections) {
// if (!selections.useCulturePackage) {
// _used -= _rcp[1];
// }
let race = RaceStore.getCurrent();
_add(ActionTypes.SELECT_RACE, race.ap, undefined, race.id);
let culture = CultureStore.getCurrent();
_add(ActionTypes.SELECT_CULTURE, culture.ap, undefined, race.id);
let profession = ProfessionStore.getCurrent() || { id: 'P_0', ap: 0 };
_add(ActionTypes.SELECT_PROFESSION, profession.ap, undefined, profession.id);
let professionVariant = ProfessionVariantStore.getCurrent();
if (professionVariant) {
_add(ActionTypes.SELECT_PROFESSION_VARIANT, professionVariant.ap, undefined, professionVariant.id);
}
// if (selections.buyLiteracy) {
// const culture = CultureStore.getCurrent();
// let id = culture.literacy.length > 1 ? selections.litc : culture.literacy[0];
// _used += ListStore.get('SA_28').sel[id - 1][2];
// }
let { attrSel, useCulturePackage, lang, buyLiteracy, litc, cantrips, combattech, curses, langLitc, spec } = selections;
// let p = ProfessionStore.getCurrent();
// if (p) {
// let apCosts = reqPurchase(p.req);
// _used += apCosts;
// }
_add('SELECT_ATTRIBUTE_MOD', undefined, undefined, attrSel);
_add('PURCHASE_CULTURE_PACKAGE', undefined, undefined, useCulturePackage);
if (lang !== 0) {
_add('SELECT_MOTHER_TONGUE', undefined, undefined, lang);
}
_add('PURCHASE_MAIN_LITERACY', undefined, undefined, buyLiteracy);
if (spec[0] !== null || spec[1] !== '') {
_add('SELECT_SKILL_SPECIALISATION', undefined, undefined, spec);
}
if (litc !== 0) {
_add('SELECT_MAIN_LITERACY', undefined, undefined, litc);
}
if (cantrips.size > 0) {
_add('SELECT_CANTRIPS', undefined, undefined, Array.from(cantrips));
}
if (combattech.size > 0) {
_add('SELECT_COMBAT_TECHNIQUES', undefined, undefined, Array.from(combattech));
}
if (curses.size > 0) {
_add('SELECT_CURSES', undefined, undefined, Array.from(curses));
}
if (langLitc.size > 0) {
_add('SELECT_LANGUAGES_AND_LITERACIES', undefined, undefined, Array.from(langLitc));
}
}
var HistoryStore = Object.assign({}, EventEmitter.prototype, {
@@ -72,18 +105,31 @@ HistoryStore.dispatchToken = AppDispatcher.register( function( payload ) {
case ActionTypes.CLEAR_HERO:
_clear();
_resetSaveIndex();
break;
case ActionTypes.RECEIVE_HERO:
_clear();
_updateAll(payload.history);
_resetSaveIndex();
break;
case ActionTypes.ASSIGN_RCP_ENTRIES:
_assignRCP(payload.selections);
_resetSaveIndex();
break;
case ActionTypes.FINALIZE_CHARACTER_CREATION:
_resetSaveIndex();
break;
case ActionTypes.CREATE_NEW_HERO:
_clear();
_resetSaveIndex();
break;
case ActionTypes.SAVE_HERO_SUCCESS:
_resetSaveIndex();
break;
default:
+2 -3
View File
@@ -145,8 +145,7 @@ var LiturgiesStore = Object.assign({}, EventEmitter.prototype, {
},
getActiveForView: function() {
// var phase = PhaseStore.get();
var phase = 1;
var phase = PhaseStore.get();
var liturgiesObj = ListStore.getObjByCategory(CATEGORY);
var liturgies = [];
@@ -177,7 +176,7 @@ var LiturgiesStore = Object.assign({}, EventEmitter.prototype, {
if (phase < 3)
_max = ELStore.getStart().max_skill + _max_bonus;
else {
let checkValues = liturgy.check.map(attr => this.get(`ATTR_${attr}`).value);
let checkValues = liturgy.check.map(attr => ListStore.get(attr).value);
_max = Math.max(...checkValues) + 2 + _max_bonus;
}
aspc.some(e => {
+4
View File
@@ -48,6 +48,10 @@ PhaseStore.dispatchToken = AppDispatcher.register( function( payload ) {
_update(2);
break;
case ActionTypes.FINALIZE_CHARACTER_CREATION:
_update(3);
break;
default:
return true;
}
+2 -3
View File
@@ -172,8 +172,7 @@ var SpellsStore = Object.assign({}, EventEmitter.prototype, {
},
getActiveForView: function() {
// var phase = PhaseStore.get();
var phase = 1;
var phase = PhaseStore.get();
var spellsObj = ListStore.getObjByCategory(CATEGORY);
var spells = [];
@@ -209,7 +208,7 @@ var SpellsStore = Object.assign({}, EventEmitter.prototype, {
if (phase < 3)
_max = ELStore.getStart().max_skill + _max_bonus;
else {
let checkValues = spell.check.map(attr => this.get(`ATTR_${attr}`).value);
let checkValues = spell.check.map(attr => ListStore.get(attr).value);
_max = Math.max(...checkValues) + 2 + _max_bonus;
}
if (SA_88_ACTIVE.indexOf(merk) === -1)
+2 -3
View File
@@ -109,8 +109,7 @@ var TalentsStore = Object.assign({}, EventEmitter.prototype, {
},
getAllForView: function() {
// var phase = PhaseStore.get();
var phase = 1;
var phase = PhaseStore.get();
var talentsObj = ListStore.getObjByCategory(CATEGORY);
var talents = [];
@@ -127,7 +126,7 @@ var TalentsStore = Object.assign({}, EventEmitter.prototype, {
if (phase < 3)
_max = ELStore.getStart().max_skill + _max_bonus;
else {
let checkValues = check.map(attr => this.get(`ATTR_${attr}`).value);
let checkValues = check.map(attr => ListStore.get(attr).value);
_max = Math.max(...checkValues) + 2 + _max_bonus;
}
talent.disabledIncrease = fw >= _max;
+20 -19
View File
@@ -250,13 +250,13 @@ var WebAPIUtils = {
},
loadHero: function(id) {
ServerActions.startLoading();
ServerActions.loadHeroSuccess(id, {
ServerActions.loadHeroSuccess(id, `{
"sex":"m",
"pers":{
_hair: 1,
_eyes: 1,
_size: 167,
_weight: 71
"_hair": 1,
"_eyes": 1,
"_size": 167,
"_weight": 71
},
"attr":{
"values":[
@@ -291,8 +291,9 @@ var WebAPIUtils = {
},
"sa":{
"active":[["SA_10",[["TAL_48","Test"]]],["SA_28",[9,14]],["SA_30",[[8,4],[23,2],[6,1]]]]
}
});
},
"history": []
}`);
// return new Promise(function(){
// jQuery.ajax(
// {
@@ -361,19 +362,19 @@ var WebAPIUtils = {
} else if (type === 'file') {
finalData = new FormData(data);
}
// return new Promise(function(){
// jQuery.ajax({
// url: 'http://cha5app.dsa-sh.de/php/uploadheropic.php?hid=' + ProfileStore.getID() + '&type=' + type + urlAdd,
// type: 'POST',
// data: finalData,
// success: function(result) {
return new Promise(function(){
jQuery.ajax({
url: 'http://cha5app.dsa-sh.de/php/uploadheropic.php?hid=' + ProfileStore.getID() + '&type=' + type + urlAdd,
type: 'POST',
data: finalData,
success: function(result) {
ServerActions.changeHeroAvatarSuccess(type === 'file' ? result : data);
// },
// error: function(error) {
// ServerActions.connectionError(error);
// }
// });
// });
},
error: function(error) {
ServerActions.connectionError(error);
}
});
});
},
deleteHero: function(heroid) {
ServerActions.startLoading();