Addes save and load of hero
This commit is contained in:
Vendored
+641
-379
File diff suppressed because it is too large
Load Diff
@@ -63,6 +63,7 @@ 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];
|
||||
}
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
import BorderButton from '../../layout/BorderButton';
|
||||
import SpecialAbilitiesActions from '../../../actions/SpecialAbilitiesActions';
|
||||
import SpecialAbilitiesStore from '../../../stores/SpecialAbilitiesStore';
|
||||
import Dropdown from '../../layout/Dropdown';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
|
||||
class SpecialAbilitiesListAddItem extends Component {
|
||||
|
||||
static propTypes = {
|
||||
apLeft: PropTypes.number,
|
||||
item: PropTypes.object
|
||||
};
|
||||
|
||||
state = {
|
||||
selected: '',
|
||||
selected_tier: 0
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
handleSelect = selected => {
|
||||
if (this.props.item.id === 'SA_10')
|
||||
this.setState({ selected, selected2: '', input: '' });
|
||||
else
|
||||
this.setState({ selected });
|
||||
};
|
||||
handleSelectTier = selected_tier => this.setState({ selected_tier });
|
||||
addToList = args => {
|
||||
SpecialAbilitiesActions.addToList(args);
|
||||
if (this.state.selected !== '' || this.state.selected_tier !== 0 || this.state.input !== '') {
|
||||
this.setState({
|
||||
selected: '',
|
||||
selected_tier: 0
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
const item = this.props.item;
|
||||
|
||||
var ap;
|
||||
var disabled = false;
|
||||
var args = { id: item.id };
|
||||
|
||||
var tierElement;
|
||||
var selectElement;
|
||||
|
||||
if (item.id === 'SA_30') {
|
||||
args.sel = this.state.selected;
|
||||
args.tier = this.state.selected_tier;
|
||||
if (this.state.selected !== '' && this.state.selected_tier !== 0)
|
||||
ap = item.ap * this.state.selected_tier;
|
||||
} else {
|
||||
if (this.state.selected !== '') {
|
||||
ap = SpecialAbilitiesStore.get(item.id).sel[this.state.selected - 1][2];
|
||||
}
|
||||
args.sel = this.state.selected;
|
||||
}
|
||||
|
||||
args.costs = 0;
|
||||
|
||||
var roman = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'];
|
||||
|
||||
if (item.tiers !== undefined && item.tiers !== null) {
|
||||
var array = [];
|
||||
if (this.props.apLeft < 4) item.tiers = 1;
|
||||
else if (this.props.apLeft < 6) item.tiers = 2;
|
||||
for (let i = 0; i < item.tiers; i++ ) {
|
||||
array.push([roman[i], i + 1]);
|
||||
}
|
||||
tierElement = (
|
||||
<Dropdown
|
||||
className="tiers"
|
||||
value={this.state.selected_tier}
|
||||
onChange={this.handleSelectTier}
|
||||
options={array} />
|
||||
);
|
||||
if (this.state.selected_tier === 0) disabled = true;
|
||||
}
|
||||
|
||||
if (item.sel !== undefined && item.sel.length > 0) {
|
||||
if (item.id === 'SA_28') item.sel = item.sel.filter(e => SpecialAbilitiesStore.get(item.id).sel[e[1] - 1][2] <= this.props.apLeft);
|
||||
selectElement = (
|
||||
<Dropdown
|
||||
value={this.state.selected}
|
||||
onChange={this.handleSelect}
|
||||
options={item.sel} />
|
||||
);
|
||||
if (this.state.selected === '') disabled = true;
|
||||
}
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td className="name">
|
||||
<div>
|
||||
<h2>{item.name}</h2>
|
||||
{selectElement}
|
||||
{tierElement}
|
||||
</div>
|
||||
</td>
|
||||
<td className="ap">{ap}</td>
|
||||
<td className="inc">
|
||||
<BorderButton label="+" disabled={disabled} onClick={this.addToList.bind(null, args)} />
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SpecialAbilitiesListAddItem;
|
||||
@@ -1,86 +0,0 @@
|
||||
import BorderButton from '../../layout/BorderButton';
|
||||
import SpecialAbilitiesActions from '../../../actions/SpecialAbilitiesActions';
|
||||
import Dropdown from '../../layout/Dropdown';
|
||||
import React, { Component, PropTypes } from 'react';
|
||||
import TextField from '../../layout/TextField';
|
||||
|
||||
class SpecialAbilitiesListRemoveItem extends Component {
|
||||
|
||||
static propTypes = {
|
||||
apLeft: PropTypes.number,
|
||||
item: PropTypes.object
|
||||
};
|
||||
|
||||
state = {
|
||||
selected_tier: 0
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
handleSelectTier = selected_tier => {
|
||||
var item = this.props.item;
|
||||
SpecialAbilitiesActions.updateTier(
|
||||
item.id,
|
||||
selected_tier,
|
||||
0,
|
||||
item.sid
|
||||
);
|
||||
};
|
||||
removeFromList = args => SpecialAbilitiesActions.removeFromList(args);
|
||||
|
||||
render() {
|
||||
|
||||
const item = this.props.item;
|
||||
|
||||
var ap = item.ap;
|
||||
var disabled = item.disabled;
|
||||
var args = { id: item.id };
|
||||
|
||||
var name = item.name;
|
||||
|
||||
var tierElement;
|
||||
|
||||
var roman = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X'];
|
||||
|
||||
if (item.tiers !== undefined && item.tiers !== null) {
|
||||
var array = [];
|
||||
item.tiers = Math.min(item.tiers, item.tier + Math.floor(this.props.apLeft / 2));
|
||||
for (let i = 0; i < item.tiers; i++ ) {
|
||||
array.push([roman[i], i + 1]);
|
||||
}
|
||||
tierElement = (
|
||||
<Dropdown
|
||||
className="tiers"
|
||||
value={item.tier}
|
||||
onChange={this.handleSelectTier}
|
||||
options={array} />
|
||||
);
|
||||
ap = item.ap * item.tier;
|
||||
}
|
||||
|
||||
args.costs = 0;
|
||||
|
||||
if (item.hasOwnProperty('sid')) args.sid = item.sid;
|
||||
|
||||
if (item.hasOwnProperty('add')) name += ` (${item.add})`;
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td className="name">
|
||||
<div>
|
||||
<h2>{name}</h2>
|
||||
{tierElement}
|
||||
</div>
|
||||
</td>
|
||||
<td className="ap">{ap}</td>
|
||||
<td className="inc">
|
||||
<BorderButton label="-" onClick={this.removeFromList.bind(null, args)} disabled={disabled} />
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SpecialAbilitiesListRemoveItem;
|
||||
@@ -1,61 +0,0 @@
|
||||
import BorderButton from '../../layout/BorderButton';
|
||||
import Dropdown from '../../layout/Dropdown';
|
||||
import RadioButtonGroup from '../../layout/RadioButtonGroup';
|
||||
import React, { PropTypes, Component } from 'react';
|
||||
import Scroll from '../../layout/Scroll';
|
||||
import Slidein from '../../layout/Slidein';
|
||||
import SpellsActions from '../../../actions/SpellsActions';
|
||||
import TextField from '../../layout/TextField';
|
||||
import classNames from 'classnames';
|
||||
|
||||
class SpellListItem extends Component {
|
||||
|
||||
static propTypes = {
|
||||
spell: PropTypes.object
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
addToList = id => SpellsActions.addToList(id);
|
||||
addPoint = id => SpellsActions.addPoint(id);
|
||||
removePoint = (id, fw) => {
|
||||
if (fw === 0) {
|
||||
SpellsActions.removeFromList(id);
|
||||
} else {
|
||||
SpellsActions.removePoint(id);
|
||||
}
|
||||
};
|
||||
|
||||
render() {
|
||||
|
||||
const spell = this.props.spell;
|
||||
|
||||
const check = spell.check.splice(0, 3);
|
||||
const checkmod = spell.check[0];
|
||||
|
||||
const GR = ['Spruch', 'Ritual', 'Fluch', 'Lied', 'Trick'];
|
||||
const MERK = ['Antimagie', 'Dämonisch', 'Einfluss', 'Elementar', 'Heilung', 'Hellsicht', 'Illusion', 'Sphären', 'Objekt', 'Telekinese', 'Verwandlung', 'Rituale'];
|
||||
|
||||
return (
|
||||
<SkillListItem
|
||||
group={GR[spell.gr - 1]}
|
||||
name={name}
|
||||
fw={spell.fw}
|
||||
check={check}
|
||||
checkmod={checkmod}
|
||||
skt={spell.skt}
|
||||
isNotActive={!spell.active}
|
||||
activate={}
|
||||
addPoint={this.addPoint.bind(null, spell.id)}
|
||||
addDisabled={spell.disabledIncrease}
|
||||
removePoint={this.removePoint.bind(null, spell.id, spell.fw)}
|
||||
removeDisabled={spell.disabledDecrease}>
|
||||
<td className="merk">{MERK[spell.merk - 1]}</td>
|
||||
</SkillListItem>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default SpellListItem;
|
||||
@@ -0,0 +1,23 @@
|
||||
// import keyMirror from 'keymirror';
|
||||
|
||||
export default {
|
||||
ADVANTAGES: 'adv',
|
||||
ATTRIBUTES: 'attributes',
|
||||
CHANTS: 'liturgies',
|
||||
COMBAT_TECHNIQUES: 'combattech',
|
||||
DISADVANTAGES: 'disadv',
|
||||
SPECIAL_ABILITIES: 'sa',
|
||||
SPELLS: 'spells',
|
||||
TALENTS: 'talents'
|
||||
};
|
||||
|
||||
// export default keyMirror({
|
||||
// ADVANTAGES: null,
|
||||
// ATTRIBUTES: null,
|
||||
// CHANTS: null,
|
||||
// COMBAT_TECHNIQUES: null,
|
||||
// DISADVANTAGES: null,
|
||||
// SPECIAL_ABILITIES: null,
|
||||
// SPELLS: null,
|
||||
// TALENTS: null
|
||||
// });
|
||||
@@ -5,8 +5,9 @@ import ListStore from './ListStore';
|
||||
import PhaseStore from './PhaseStore';
|
||||
import RaceStore from './rcp/RaceStore';
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import Categories from '../constants/Categories';
|
||||
|
||||
const CATEGORY = 'attributes';
|
||||
const CATEGORY = Categories.ATTRIBUTES;
|
||||
|
||||
var _le = 5;
|
||||
var _le_add = 0;
|
||||
@@ -38,6 +39,20 @@ function _addMaxEnergyPoint(id) {
|
||||
}
|
||||
}
|
||||
|
||||
function _updateAll(obj) {
|
||||
obj.values.forEach(e => {
|
||||
ListStore.setProperty(e[0], 'value', e[1]);
|
||||
ListStore.setProperty(e[0], 'mod', e[2]);
|
||||
});
|
||||
_le = obj._le;
|
||||
_le_add = obj._le_add;
|
||||
_ae_add = obj._ae_add;
|
||||
_ke_add = obj._ke_add;
|
||||
_sk = obj._sk;
|
||||
_zk = obj._zk;
|
||||
_gs = obj._gs;
|
||||
}
|
||||
|
||||
function _assignRCP(selections) {
|
||||
let currentRace = RaceStore.getCurrent() || {};
|
||||
let mod = 0;
|
||||
@@ -77,7 +92,7 @@ var AttributeStore = Object.assign({}, EventEmitter.prototype, {
|
||||
|
||||
getForSave: function() {
|
||||
return {
|
||||
values: ListStore.getAllByCategory(CATEGORY).map(e => [e.value, e.mod]),
|
||||
values: ListStore.getAllByCategory(CATEGORY).map(e => [e.id, e.value, e.mod]),
|
||||
_le, _le_add, _ae_add, _ke_add, _sk, _zk, _gs
|
||||
};
|
||||
},
|
||||
@@ -155,6 +170,10 @@ AttributeStore.dispatchToken = AppDispatcher.register( function( payload ) {
|
||||
|
||||
switch( payload.actionType ) {
|
||||
|
||||
case ActionTypes.RECEIVE_HERO:
|
||||
_updateAll(payload.attr);
|
||||
break;
|
||||
|
||||
case ActionTypes.ADD_ATTRIBUTE_POINT:
|
||||
_addPoint(payload.id);
|
||||
break;
|
||||
|
||||
@@ -6,8 +6,9 @@ import PhaseStore from './PhaseStore';
|
||||
import ProfessionStore from './rcp/ProfessionStore';
|
||||
import ProfessionVariantStore from './rcp/ProfessionVariantStore';
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import Categories from '../constants/Categories';
|
||||
|
||||
const CATEGORY = 'combattech';
|
||||
const CATEGORY = Categories.COMBAT_TECHNIQUES;
|
||||
|
||||
var _filter = '';
|
||||
var _sortOrder = 'name';
|
||||
@@ -28,6 +29,12 @@ function _updateSortOrder(option) {
|
||||
_sortOrder = option;
|
||||
}
|
||||
|
||||
function _updateAll(obj) {
|
||||
obj.active.forEach(e => {
|
||||
ListStore.setSR(...e);
|
||||
});
|
||||
}
|
||||
|
||||
function _assignRCP(selections) {
|
||||
var list = [];
|
||||
|
||||
@@ -173,6 +180,11 @@ var CombatTechniquesStore = Object.assign({}, EventEmitter.prototype, {
|
||||
CombatTechniquesStore.dispatchToken = AppDispatcher.register( function( payload ) {
|
||||
|
||||
switch( payload.actionType ) {
|
||||
|
||||
case ActionTypes.RECEIVE_HERO:
|
||||
_updateAll(payload.ct);
|
||||
break;
|
||||
|
||||
case ActionTypes.FILTER_COMBATTECHNIQUES:
|
||||
_updateFilterText(payload.text);
|
||||
break;
|
||||
|
||||
@@ -2,12 +2,16 @@ import AppDispatcher from '../dispatcher/AppDispatcher';
|
||||
import { EventEmitter } from 'events';
|
||||
import ELStore from './ELStore';
|
||||
import ListStore from './ListStore';
|
||||
import LiturgiesStore from './LiturgiesStore';
|
||||
import RaceStore from './rcp/RaceStore';
|
||||
import SpellsStore from './SpellsStore';
|
||||
import TalentsStore from './TalentsStore';
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import validate from '../utils/validate';
|
||||
import Categories from '../constants/Categories';
|
||||
|
||||
const CATEGORY_1 = 'adv';
|
||||
const CATEGORY_2 = 'disadv';
|
||||
const CATEGORY_1 = Categories.ADVANTAGES;
|
||||
const CATEGORY_2 = Categories.DISADVANTAGES;
|
||||
|
||||
var _filter = '';
|
||||
var _showRating = true;
|
||||
@@ -32,13 +36,6 @@ function _activate(payload) {
|
||||
obj.active.push(sel);
|
||||
new_sid = sel;
|
||||
break;
|
||||
case 'ADV_28':
|
||||
case 'ADV_29':
|
||||
if (input[0] === '' && input[1] === '')
|
||||
obj.active.push(sel);
|
||||
else if (obj.active.filter(e => e[0] === input[0]).length === 0)
|
||||
obj.active.push(input);
|
||||
break;
|
||||
case 'DISADV_1':
|
||||
case 'DISADV_34':
|
||||
case 'DISADV_50':
|
||||
@@ -154,6 +151,36 @@ function _updateTier(id, tier, sid) {
|
||||
ListStore.set(id, obj);
|
||||
}
|
||||
|
||||
function _updateAll(payload) {
|
||||
payload.active.forEach(e => {
|
||||
let [ id, options ] = e;
|
||||
var obj = ListStore.get(id);
|
||||
if (obj.max !== null) {
|
||||
ListStore.setProperty(id, 'active', options);
|
||||
switch (id) {
|
||||
case 'ADV_4':
|
||||
case 'ADV_16':
|
||||
case 'DISADV_48':
|
||||
options.forEach(p => {
|
||||
ListStore.addDependencies(obj.req, p);
|
||||
});
|
||||
break;
|
||||
default:
|
||||
options.forEach(() => {
|
||||
ListStore.addDependencies(obj.req);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ListStore.activate(id);
|
||||
ListStore.addDependencies(obj.req);
|
||||
for (let property in options) {
|
||||
ListStore.setProperty(id, property, options[property]);
|
||||
}
|
||||
}
|
||||
});
|
||||
_showRating = payload._showRating;
|
||||
}
|
||||
|
||||
function _assignRCP() {
|
||||
var list = new Set();
|
||||
|
||||
@@ -571,6 +598,10 @@ DisAdvStore.dispatchToken = AppDispatcher.register( function( payload ) {
|
||||
|
||||
switch( payload.actionType ) {
|
||||
|
||||
case ActionTypes.RECEIVE_HERO:
|
||||
_updateAll(payload.disadv);
|
||||
break;
|
||||
|
||||
case ActionTypes.FILTER_DISADV:
|
||||
_updateFilterText(payload.text);
|
||||
break;
|
||||
@@ -596,6 +627,7 @@ DisAdvStore.dispatchToken = AppDispatcher.register( function( payload ) {
|
||||
break;
|
||||
|
||||
case ActionTypes.RECEIVE_RAW_LISTS:
|
||||
AppDispatcher.waitFor([LiturgiesStore.dispatchToken, SpellsStore.dispatchToken, TalentsStore.dispatchToken]);
|
||||
DisAdvStore.init(payload.adv, payload.disadv);
|
||||
break;
|
||||
|
||||
|
||||
@@ -118,6 +118,10 @@ var ListStore = Object.assign({}, EventEmitter.prototype, {
|
||||
_list[id].fw = value;
|
||||
},
|
||||
|
||||
setProperty: function(id, property, value) {
|
||||
_list[id][property] = value;
|
||||
},
|
||||
|
||||
addToProperty: function(id, property, value) {
|
||||
_list[id][property] += value;
|
||||
},
|
||||
|
||||
@@ -5,8 +5,9 @@ import ListStore from './ListStore';
|
||||
import PhaseStore from './PhaseStore';
|
||||
import ProfessionStore from './rcp/ProfessionStore';
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import Categories from '../constants/Categories';
|
||||
|
||||
const CATEGORY = 'liturgies';
|
||||
const CATEGORY = Categories.CHANTS;
|
||||
|
||||
var _filter = '';
|
||||
var _sortOrder = 'name';
|
||||
@@ -35,6 +36,15 @@ function _updateSortOrder(option) {
|
||||
_sortOrder = option;
|
||||
}
|
||||
|
||||
function _updateAll(obj) {
|
||||
obj.active.forEach(e => {
|
||||
ListStore.activate(e[0]);
|
||||
if (ListStore.get(e[0]).gr !== 3) {
|
||||
ListStore.setSR(...e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _assignRCP() {
|
||||
var list = [];
|
||||
|
||||
@@ -221,6 +231,10 @@ LiturgiesStore.dispatchToken = AppDispatcher.register( function( payload ) {
|
||||
|
||||
switch( payload.actionType ) {
|
||||
|
||||
case ActionTypes.RECEIVE_HERO:
|
||||
_updateAll(payload.chants);
|
||||
break;
|
||||
|
||||
case ActionTypes.FILTER_LITURGIES:
|
||||
_updateFilterText(payload.text);
|
||||
break;
|
||||
|
||||
@@ -7,9 +7,10 @@ import ProfessionStore from './rcp/ProfessionStore';
|
||||
import ProfessionVariantStore from './rcp/ProfessionVariantStore';
|
||||
import TalentsStore from './TalentsStore';
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import Categories from '../constants/Categories';
|
||||
import validate from '../utils/validate';
|
||||
|
||||
const CATEGORY = 'special';
|
||||
const CATEGORY = Categories.SPECIAL_ABILITIES;
|
||||
const GROUPS = ['Allgemein', 'Schicksal', 'Kampf', 'Magisch', 'Magisch (Stab)', 'Magisch (Hexe)', 'Geweiht'];
|
||||
|
||||
var _filter = '';
|
||||
@@ -28,7 +29,6 @@ function _activate(payload) {
|
||||
var addreq = [];
|
||||
if (obj.max !== null) {
|
||||
if (obj.id === 'SA_10') {
|
||||
console.log(payload);
|
||||
if (payload.input === '') {
|
||||
obj.active.push([payload.sel, payload.sel2]);
|
||||
addreq.push([payload.sel, obj.active.filter(e => e[0] === payload.sel).length * 6]);
|
||||
@@ -109,6 +109,40 @@ function _updateTier(id, tier, sid) {
|
||||
ListStore.set(id, obj);
|
||||
}
|
||||
|
||||
function _updateAll(payload) {
|
||||
payload.active.forEach(e => {
|
||||
let [ id, options ] = e;
|
||||
var obj = ListStore.get(id);
|
||||
if (obj.max !== null) {
|
||||
ListStore.setProperty(id, 'active', options);
|
||||
switch (id) {
|
||||
case 'SA_10': {
|
||||
let counter = new Map();
|
||||
options.forEach(p => {
|
||||
if (counter.has(p[0])) {
|
||||
counter.set(p[0], counter.get(p[0]) + 1);
|
||||
} else {
|
||||
counter.set(p[0], 1);
|
||||
}
|
||||
ListStore.addDependencies(obj.req.concat([[p[0], counter.get(p[0]) * 6]]));
|
||||
});
|
||||
break;
|
||||
}
|
||||
default:
|
||||
options.forEach(() => {
|
||||
ListStore.addDependencies(obj.req);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ListStore.activate(id);
|
||||
ListStore.addDependencies(obj.req);
|
||||
for (let property in options) {
|
||||
ListStore.setProperty(id, property, options[property]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _assignRCP(selections) {
|
||||
var list = new Set();
|
||||
|
||||
@@ -556,6 +590,10 @@ SpecialAbilitiesStore.dispatchToken = AppDispatcher.register( function( payload
|
||||
|
||||
switch( payload.actionType ) {
|
||||
|
||||
case ActionTypes.RECEIVE_HERO:
|
||||
_updateAll(payload.sa);
|
||||
break;
|
||||
|
||||
case ActionTypes.FILTER_SPECIALABILITIES:
|
||||
_updateFilterText(payload.text);
|
||||
break;
|
||||
|
||||
@@ -5,8 +5,9 @@ import ListStore from './ListStore';
|
||||
import PhaseStore from './PhaseStore';
|
||||
import ProfessionStore from './rcp/ProfessionStore';
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import Categories from '../constants/Categories';
|
||||
|
||||
const CATEGORY = 'spells';
|
||||
const CATEGORY = Categories.SPELLS;
|
||||
|
||||
const TRADITIONS = ['Allgemein', 'Gildenmagier', 'Hexen', 'Elfen'];
|
||||
|
||||
@@ -37,6 +38,15 @@ function _updateSortOrder(option) {
|
||||
_sortOrder = option;
|
||||
}
|
||||
|
||||
function _updateAll(obj) {
|
||||
obj.active.forEach(e => {
|
||||
ListStore.activate(e[0]);
|
||||
if (ListStore.get(e[0]).gr !== 5) {
|
||||
ListStore.setSR(...e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _assignRCP(selections) {
|
||||
var list = [];
|
||||
|
||||
@@ -256,6 +266,10 @@ SpellsStore.dispatchToken = AppDispatcher.register( function( payload ) {
|
||||
|
||||
switch( payload.actionType ) {
|
||||
|
||||
case ActionTypes.RECEIVE_HERO:
|
||||
_updateAll(payload.spells);
|
||||
break;
|
||||
|
||||
case ActionTypes.FILTER_SPELLS:
|
||||
_updateFilterText(payload.text);
|
||||
break;
|
||||
|
||||
@@ -7,8 +7,9 @@ import PhaseStore from './PhaseStore';
|
||||
import ProfessionStore from './rcp/ProfessionStore';
|
||||
import ProfessionVariantStore from './rcp/ProfessionVariantStore';
|
||||
import ActionTypes from '../constants/ActionTypes';
|
||||
import Categories from '../constants/Categories';
|
||||
|
||||
const CATEGORY = 'talents';
|
||||
const CATEGORY = Categories.TALENTS;
|
||||
|
||||
var _filter = '';
|
||||
var _sortOrder = 'groups';
|
||||
@@ -34,6 +35,13 @@ function _updateTalentRating() {
|
||||
_talentRating = !_talentRating;
|
||||
}
|
||||
|
||||
function _updateAll(obj) {
|
||||
obj.active.forEach(e => {
|
||||
ListStore.setSR(...e);
|
||||
});
|
||||
_talentRating = obj._talentRating;
|
||||
}
|
||||
|
||||
function _assignRCP(selections) {
|
||||
var list = [];
|
||||
|
||||
@@ -173,6 +181,10 @@ TalentsStore.dispatchToken = AppDispatcher.register( function( payload ) {
|
||||
|
||||
switch( payload.actionType ) {
|
||||
|
||||
case ActionTypes.RECEIVE_HERO:
|
||||
_updateAll(payload.talents);
|
||||
break;
|
||||
|
||||
case ActionTypes.FILTER_TALENTS:
|
||||
_updateFilterText(payload.text);
|
||||
break;
|
||||
|
||||
@@ -3,16 +3,29 @@ import { EventEmitter } from 'events';
|
||||
import ActionTypes from '../../constants/ActionTypes';
|
||||
|
||||
var _heroes = {
|
||||
|
||||
'H_0': {
|
||||
client_version: '1.0.0',
|
||||
date: new Date('2016-10-18T16:18:28.420Z'),
|
||||
id: 'H_0',
|
||||
name: 'Shimo ibn Rashdul',
|
||||
avatar: 'images/portrait.png',
|
||||
ap: { _max: 1460, _used: 1459 },
|
||||
ap: {
|
||||
_max: 1100,
|
||||
_used: 799,
|
||||
_rcp: [0, 12, 207, 14],
|
||||
_adv: 63,
|
||||
_adv_mag: 0,
|
||||
_adv_kar: 0,
|
||||
_disadv: 39,
|
||||
_disadv_mag: 0,
|
||||
_disadv_kar: 0
|
||||
},
|
||||
el: 'EL_3',
|
||||
r: 'R_5',
|
||||
c: 'C_7',
|
||||
p: 'P_24',
|
||||
pv: null
|
||||
r: 'R_1',
|
||||
c: 'C_8',
|
||||
p: 'P_6',
|
||||
pv: 'PV_21'
|
||||
},
|
||||
'H_1': {
|
||||
id: 'H_1',
|
||||
|
||||
@@ -3,8 +3,8 @@ import { EventEmitter } from 'events';
|
||||
import ActionTypes from '../../constants/ActionTypes';
|
||||
import PhaseStore from '../PhaseStore';
|
||||
|
||||
var _currentTab = 'profile';
|
||||
var _currentSection = 'hero';
|
||||
var _currentTab = 'herolist';
|
||||
var _currentSection = 'main';
|
||||
|
||||
function _updateTab(tab) {
|
||||
_currentTab = tab;
|
||||
|
||||
+36
-2
@@ -200,12 +200,46 @@ var WebAPIUtils = {
|
||||
},
|
||||
loadHero: function(id) {
|
||||
ServerActions.loadHeroSuccess(id, {
|
||||
sex: 'm',
|
||||
pers: {
|
||||
"sex":"m",
|
||||
"pers":{
|
||||
_hair: 1,
|
||||
_eyes: 1,
|
||||
_size: 167,
|
||||
_weight: 71
|
||||
},
|
||||
"attr":{
|
||||
"values":[
|
||||
["ATTR_1",12,0],
|
||||
["ATTR_2",13,0],
|
||||
["ATTR_3",12,0],
|
||||
["ATTR_4",13,0],
|
||||
["ATTR_5",14,1],
|
||||
["ATTR_6",13,0],
|
||||
["ATTR_7",12,0],
|
||||
["ATTR_8",11,0]
|
||||
],
|
||||
"_le":5,
|
||||
"_le_add":0,
|
||||
"_ae_add":0,
|
||||
"_ke_add":0,
|
||||
"_sk":-5,
|
||||
"_zk":-5,
|
||||
"_gs":8
|
||||
},
|
||||
"disadv":{
|
||||
"active":[
|
||||
["ADV_3",{}],["ADV_5",{}],["ADV_40",{}],["ADV_47",{"sid":"CT_2"}],["ADV_49",{}],["DISADV_1",[[2,2]]],["DISADV_15",{}],["DISADV_25",{}],["DISADV_40",{"tier":1}]
|
||||
],
|
||||
"_showRating":true
|
||||
},
|
||||
"talents":{
|
||||
"active":[["TAL_8",6],["TAL_10",4],["TAL_18",7],["TAL_20",5],["TAL_21",4],["TAL_25",4],["TAL_28",9],["TAL_29",7],["TAL_34",4],["TAL_38",5],["TAL_39",3],["TAL_40",2],["TAL_47",5],["TAL_48",8],["TAL_50",7],["TAL_51",1],["TAL_55",1],["TAL_59",1]],
|
||||
"_talentRating":true},
|
||||
"ct":{
|
||||
"active":[["CT_3",8],["CT_5",8]]},"spells":{"active":[]},"chants":{"active":[]
|
||||
},
|
||||
"sa":{
|
||||
"active":[["SA_10",[["TAL_48","Test"]]],["SA_28",[9,14]],["SA_30",[[8,4],[23,2],[6,1]]]]
|
||||
}
|
||||
});
|
||||
// return new Promise(function(){
|
||||
|
||||
@@ -12,11 +12,14 @@ import RaceStore from '../stores/rcp/RaceStore';
|
||||
import SpecialAbilitiesStore from '../stores/SpecialAbilitiesStore';
|
||||
import SpellsStore from '../stores/SpellsStore';
|
||||
import TalentsStore from '../stores/TalentsStore';
|
||||
import VersionStore from '../stores/core/VersionStore';
|
||||
import WebAPIUtils from './WebAPIUtils';
|
||||
|
||||
export default () => {
|
||||
var data = [
|
||||
{
|
||||
client_version: VersionStore.get(),
|
||||
date: (new Date()).toJSON(),
|
||||
id: 'H_0',
|
||||
name: ProfileStore.getName(),
|
||||
avatar: ProfileStore.getPortrait(),
|
||||
|
||||
Reference in New Issue
Block a user