Changed data objects to ES6 classes

Additionally changed folder structure to components and views
This commit is contained in:
Lukas Obermann
2016-11-14 00:18:09 +01:00
parent 45f0516a6d
commit e1927227bf
147 changed files with 14039 additions and 19856 deletions
+28 -2
View File
@@ -1,4 +1,30 @@
{
"presets": ["es2015", "react", "stage-1"],
"plugins": ["transform-class-properties", "transform-do-expressions", "transform-object-assign", "transform-object-rest-spread", "transform-runtime"]
"presets": [
"react",
"stage-1"
],
"plugins": [
"transform-class-properties",
"transform-do-expressions",
"transform-object-rest-spread",
"transform-es2015-destructuring",
"transform-es2015-modules-commonjs",
"transform-es2015-parameters",
"transform-runtime"
],
"env": {
"production": {
"presets": [
"es2015",
"react",
"stage-1"
],
"plugins": [
"transform-class-properties",
"transform-do-expressions",
"transform-object-rest-spread",
"transform-runtime"
]
}
}
}
+13026 -18286
View File
File diff suppressed because it is too large Load Diff
+1 -24
View File
File diff suppressed because one or more lines are too long
-6
View File
@@ -1,6 +0,0 @@
import AppDispatcher from '../dispatcher/AppDispatcher';
import ActionTypes from '../constants/ActionTypes';
var DetailsActions = {};
export default DetailsActions;
-37
View File
@@ -1,37 +0,0 @@
var AppDispatcher = require('../dispatcher/AppDispatcher');
var EventEmitter = require('events').EventEmitter;
var ActionTypes = require('../constants/ActionTypes');
var DetailsStore = Object.assign({}, EventEmitter.prototype, {
emitChange: function() {
this.emit('change');
},
addChangeListener: function(callback) {
this.on('change', callback);
},
removeChangeListener: function(callback) {
this.removeListener('change', callback);
}
});
DetailsStore.dispatchToken = AppDispatcher.register( function( payload ) {
switch( payload.actionType ) {
case 'TEST':
break;
default:
return true;
}
DetailsStore.emitChange();
return true;
});
module.exports = DetailsStore;
-37
View File
@@ -1,37 +0,0 @@
var AppDispatcher = require('../dispatcher/AppDispatcher');
var EventEmitter = require('events').EventEmitter;
var ActionTypes = require('../constants/ActionTypes');
var EquipmentStore = Object.assign({}, EventEmitter.prototype, {
emitChange: function() {
this.emit('change');
},
addChangeListener: function(callback) {
this.on('change', callback);
},
removeChangeListener: function(callback) {
this.removeListener('change', callback);
}
});
EquipmentStore.dispatchToken = AppDispatcher.register( function( payload ) {
switch( payload.actionType ) {
case 'TEST':
break;
default:
return true;
}
EquipmentStore.emitChange();
return true;
});
module.exports = EquipmentStore;
-37
View File
@@ -1,37 +0,0 @@
var AppDispatcher = require('../dispatcher/AppDispatcher');
var EventEmitter = require('events').EventEmitter;
var ActionTypes = require('../constants/ActionTypes');
var InventoryStore = Object.assign({}, EventEmitter.prototype, {
emitChange: function() {
this.emit('change');
},
addChangeListener: function(callback) {
this.on('change', callback);
},
removeChangeListener: function(callback) {
this.removeListener('change', callback);
}
});
InventoryStore.dispatchToken = AppDispatcher.register( function( payload ) {
switch( payload.actionType ) {
case 'TEST':
break;
default:
return true;
}
InventoryStore.emitChange();
return true;
});
module.exports = InventoryStore;
-37
View File
@@ -1,37 +0,0 @@
var AppDispatcher = require('../dispatcher/AppDispatcher');
var EventEmitter = require('events').EventEmitter;
var ActionTypes = require('../constants/ActionTypes');
var SheetsStore = Object.assign({}, EventEmitter.prototype, {
emitChange: function() {
this.emit('change');
},
addChangeListener: function(callback) {
this.on('change', callback);
},
removeChangeListener: function(callback) {
this.removeListener('change', callback);
}
});
SheetsStore.dispatchToken = AppDispatcher.register( function( payload ) {
switch( payload.actionType ) {
case 'TEST':
break;
default:
return true;
}
SheetsStore.emitChange();
return true;
});
module.exports = SheetsStore;
+2 -2
View File
@@ -1,7 +1,7 @@
import AppController from './components/AppController';
import AppDispatcher from './dispatcher/AppDispatcher';
import React from 'react';
import ReactDOM from 'react-dom';
import Router from './views/Router';
import WebAPIUtils from './utils/WebAPIUtils';
// if (localStorage['lastUrl'] !== '') {
@@ -19,6 +19,6 @@ window.onunload = function() {
});
};
ReactDOM.render( <AppController />, document.getElementById('bodywrapper') );
ReactDOM.render( <Router />, document.getElementById('bodywrapper') );
WebAPIUtils.getAllData();
+5 -5
View File
@@ -2,14 +2,14 @@ import AppDispatcher from '../dispatcher/AppDispatcher';
import ActionTypes from '../constants/ActionTypes';
import WebAPIUtils from '../utils/WebAPIUtils';
import createOverlay from '../utils/createOverlay';
import ForgotUsername from '../components/content/account/ForgotUsername';
import ForgotPassword from '../components/content/account/ForgotPassword';
import Login from '../components/content/account/Login';
import ForgotUsername from '../views/account/ForgotUsername';
import ForgotPassword from '../views/account/ForgotPassword';
import Login from '../views/account/Login';
import React from 'react';
import reactAlert from '../utils/reactAlert';
import ReactDOM from 'react-dom';
import Register from '../components/content/account/Register';
import ResendActivation from '../components/content/account/ResendActivation';
import Register from '../views/account/Register';
import ResendActivation from '../views/account/ResendActivation';
var AccountActions = {
showRegister: function() {
+1 -1
View File
@@ -2,7 +2,7 @@ import AppDispatcher from '../dispatcher/AppDispatcher';
import ActionTypes from '../constants/ActionTypes';
import createOverlay from '../utils/createOverlay';
import ELStore from '../stores/ELStore';
import HeroCreation from '../components/content/herolist/HeroCreation';
import HeroCreation from '../views/herolist/HeroCreation';
import React from 'react';
import reactAlert from '../utils/reactAlert';
import ReactDOM from 'react-dom';
+1 -1
View File
@@ -1,7 +1,7 @@
import AppDispatcher from '../dispatcher/AppDispatcher';
import ActionTypes from '../constants/ActionTypes';
import createOverlay from '../utils/createOverlay';
import Dialog from '../components/layout/Dialog';
import Dialog from '../components/Dialog';
import React from 'react';
import ReactDOM from 'react-dom';
+1 -1
View File
@@ -2,7 +2,7 @@ import AppDispatcher from '../dispatcher/AppDispatcher';
import ActionTypes from '../constants/ActionTypes';
import React from 'react';
import ReactDOM from 'react-dom';
import Selections from '../components/content/rcp/Selections';
import Selections from '../views/rcp/Selections';
var ProfessionActions = {
receiveAll: function(rawProfessions) {
+2 -2
View File
@@ -2,10 +2,10 @@ import AppDispatcher from '../dispatcher/AppDispatcher';
import ActionTypes from '../constants/ActionTypes';
import WebAPIUtils from '../utils/WebAPIUtils';
import createOverlay from '../utils/createOverlay';
import ProfileAvatarChange from '../components/content/profile/ProfileAvatarChange';
import ProfileAvatarChange from '../views/profile/ProfileAvatarChange';
import React from 'react';
import ReactDOM from 'react-dom';
import Selections from '../components/content/rcp/Selections';
import Selections from '../views/rcp/Selections';
var ProfileActions = {
changeName: function(name) {
@@ -7,10 +7,6 @@ class Box extends Component {
className: PropTypes.string
};
constructor(props) {
super(props);
}
render() {
let { children, className, ...other } = this.props;
@@ -11,10 +11,6 @@ class Checkbox extends Component {
disabled: PropTypes.bool
};
constructor(props) {
super(props);
}
render() {
const className = classNames('checkbox', this.props.checked && 'checked', this.props.disabled && 'disabled', this.props.className);
@@ -15,10 +15,6 @@ class Collapse extends Component {
height: 'auto'
};
constructor(props) {
super(props);
}
render() {
const className = classNames('collapse', this.props.expanded && 'expanded', this.props.className);
@@ -3,7 +3,7 @@ import GeminiScrollbar from 'react-gemini-scrollbar';
import React, { Component, PropTypes } from 'react';
import ReactDOM from 'react-dom';
import classNames from 'classnames';
import { close } from '../../utils/createOverlay';
import { close } from '../utils/createOverlay';
class Dialog extends Component {
@@ -15,10 +15,6 @@ class Dialog extends Component {
title: PropTypes.any
}
constructor(props) {
super(props);
}
close = () => close(this.props.node);
clickButton = (func) => {
@@ -19,10 +19,6 @@ class Dropdown extends Component {
clickInside = false;
constructor(props) {
super(props);
}
switch = () => {
if (!this.state.isOpen) {
var height = this.props.options.length < 6 ? this.props.options.length * 33 + 1 : 166;
@@ -11,10 +11,6 @@ class IconButton extends Component {
primary: PropTypes.bool
};
constructor(props) {
super(props);
}
render() {
const className = classNames('btn-icon', this.props.primary && 'btn-primary', this.props.disabled && 'disabled', this.props.className);
@@ -10,10 +10,6 @@ class LabelBox extends Component {
value: PropTypes.any
};
constructor(props) {
super(props);
}
render() {
const { children, label, value } = this.props;
@@ -9,10 +9,6 @@ class Plain extends Component {
value: PropTypes.any
};
constructor(props) {
super(props);
}
render() {
const className = classNames( 'plain', this.props.className );
@@ -9,10 +9,6 @@ class RadioButton extends Component {
onClick: PropTypes.func.isRequired
};
constructor(props) {
super(props);
}
render() {
const className = classNames('radiobutton', this.props.active && 'active', this.props.disabled && 'disabled');
@@ -10,10 +10,6 @@ class RadioButtonGroup extends Component {
array: PropTypes.array.isRequired
};
constructor(props) {
super(props);
}
render() {
const { active, array, disabled, onClick } = this.props;
@@ -1,5 +1,5 @@
import React, { Component, PropTypes } from 'react';
import GeminiScrollbar from 'react-gemini-scrollbar';
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
class Scroll extends Component {
@@ -8,10 +8,6 @@ class Scroll extends Component {
className: PropTypes.any
}
constructor(props) {
super(props);
}
render() {
const className = classNames('scroll', this.props.className);
@@ -8,10 +8,6 @@ class Slidein extends Component {
isOpen: PropTypes.bool
};
constructor(props) {
super(props);
}
shouldComponentUpdate(nextProps) {
return nextProps.isOpen !== this.props.isOpen || this.props.isOpen === true;
}
@@ -12,10 +12,6 @@ class Slider extends Component {
max: PropTypes.number.isRequired
};
constructor(props) {
super(props);
}
render() {
const className = classNames('slider', this.props.className);
@@ -9,10 +9,6 @@ class Subtabs extends Component {
tabs: PropTypes.array
};
constructor(props) {
super(props);
}
render() {
return (
<div className="subtabs">
@@ -10,10 +10,6 @@ class Tab extends Component {
onClick: PropTypes.func
};
constructor(props) {
super(props);
}
render() {
const { disabled, active, label, children, onClick } = this.props;
@@ -9,10 +9,6 @@ class TextBox extends Component {
value: PropTypes.any
};
constructor(props) {
super(props);
}
render() {
const { children, label, value } = this.props;
@@ -25,10 +25,6 @@ class TextField extends Component {
type: 'text'
};
constructor(props) {
super(props);
}
componentDidMount() {
if (this.props.autoFocus) ReactDOM.findDOMNode(this.refs.inputElement).focus();
}
-81
View File
@@ -1,81 +0,0 @@
import About from './about/About';
import Account from './account/Account';
import Attribute from './attributes/Attribute';
import DisAdv from './disadv/DisAdv';
import Grouplist from './grouplist/Grouplist';
import Herolist from './herolist/Herolist';
import Home from './home/Home';
import Items from './items/Items';
import Master from './master/Master';
import Profile from './profile/Profile';
import React, { Component, PropTypes } from 'react';
import RCP from './rcp/RCP';
import Skills from './skills/Skills';
import TitleBar from '../layout/TitleBar';
class Content extends Component {
static propTypes = {
section: PropTypes.string.isRequired,
tab: PropTypes.string.isRequired
};
constructor(props) {
super(props);
}
render() {
var tabElement;
switch (this.props.tab) {
case 'home':
tabElement = <Home />;
break;
case 'herolist':
tabElement = <Herolist />;
break;
case 'grouplist':
tabElement = <Grouplist />;
break;
case 'account':
tabElement = <Account />;
break;
case 'about':
tabElement = <About />;
break;
case 'rcp':
tabElement = <RCP />;
break;
case 'profile':
tabElement = <Profile />;
break;
case 'attributes':
tabElement = <Attribute />;
break;
case 'disadv':
tabElement = <DisAdv />;
break;
case 'skills':
tabElement = <Skills />;
break;
case 'items':
tabElement = <Items />;
break;
case 'master':
tabElement = <Master />;
break;
}
return (
<main>
<TitleBar {...this.props} />
{tabElement}
</main>
);
}
}
export default Content;
@@ -1,44 +0,0 @@
import AttributeStore from '../../../stores/AttributeStore';
import APStore from '../../../stores/APStore';
import Avatar from '../../layout/Avatar';
import Box from '../../layout/sheets/Box';
import CultureStore from '../../../stores/CultureStore';
import DisAdvStore from '../../../stores/DisAdvStore';
import ELStore from '../../../stores/ELStore';
import LabelBox from '../../layout/sheets/LabelBox';
import MainSheetCalcItem from './MainSheetCalcItem';
import OverviewConstSkills from './OverviewConstSkills';
import Plain from '../../layout/sheets/Plain';
import ProfessionStore from '../../../stores/ProfessionStore';
import ProfessionVariantStore from '../../../stores/ProfessionVariantStore';
import RaceStore from '../../../stores/RaceStore';
import React, { Component } from 'react';
import SheetHeader from './SheetHeader';
import TextBox from '../../layout/sheets/TextBox';
class ChantSheet extends Component {
constructor(props) {
super(props);
}
render() {
const addHeader = [
{ short: 'KaP Max.', value: 0 },
{ short: 'Aktuell' }
];
return (
<div className="sheet chants">
<SheetHeader title="Liturgien & Zeremonien" add={addHeader} />
<div className="upper">
<TextBox label="Liturgien & Zeremonien">
</TextBox>
</div>
</div>
);
}
}
export default ChantSheet;
@@ -1,37 +0,0 @@
import AttributeStore from '../../../stores/AttributeStore';
import APStore from '../../../stores/APStore';
import Avatar from '../../layout/Avatar';
import Box from '../../layout/sheets/Box';
import CultureStore from '../../../stores/CultureStore';
import DisAdvStore from '../../../stores/DisAdvStore';
import ELStore from '../../../stores/ELStore';
import LabelBox from '../../layout/sheets/LabelBox';
import MainSheetCalcItem from './MainSheetCalcItem';
import Plain from '../../layout/sheets/Plain';
import ProfessionStore from '../../../stores/ProfessionStore';
import ProfessionVariantStore from '../../../stores/ProfessionVariantStore';
import RaceStore from '../../../stores/RaceStore';
import React, { Component } from 'react';
import SheetHeader from './SheetHeader';
import TextBox from '../../layout/sheets/TextBox';
class InventorySheet extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="sheet inventory">
<SheetHeader title="Besitz" />
<div className="upper">
<TextBox label="Ausrüstung">
</TextBox>
</div>
</div>
);
}
}
export default InventorySheet;
@@ -1,44 +0,0 @@
import AttributeStore from '../../../stores/AttributeStore';
import APStore from '../../../stores/APStore';
import Avatar from '../../layout/Avatar';
import Box from '../../layout/sheets/Box';
import CultureStore from '../../../stores/CultureStore';
import DisAdvStore from '../../../stores/DisAdvStore';
import ELStore from '../../../stores/ELStore';
import LabelBox from '../../layout/sheets/LabelBox';
import MainSheetCalcItem from './MainSheetCalcItem';
import OverviewConstSkills from './OverviewConstSkills';
import Plain from '../../layout/sheets/Plain';
import ProfessionStore from '../../../stores/ProfessionStore';
import ProfessionVariantStore from '../../../stores/ProfessionVariantStore';
import RaceStore from '../../../stores/RaceStore';
import React, { Component } from 'react';
import SheetHeader from './SheetHeader';
import TextBox from '../../layout/sheets/TextBox';
class SpellsSheet extends Component {
constructor(props) {
super(props);
}
render() {
const addHeader = [
{ short: 'AsP Max.', value: 0 },
{ short: 'Aktuell' }
];
return (
<div className="sheet spells">
<SheetHeader title="Zauber & Rituale" add={addHeader} />
<div className="upper">
<TextBox label="Zauber & Rituale">
</TextBox>
</div>
</div>
);
}
}
export default SpellsSheet;
-20
View File
@@ -1,20 +0,0 @@
import React, { Component } from 'react';
class ToolBar extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div id="toolbar">
<div className="toolbar-inner">
{this.props.children}
</div>
</div>
);
}
}
export default ToolBar;
-31
View File
@@ -1,31 +0,0 @@
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
class HeaderButton extends Component {
static propTypes = {
icon: PropTypes.string.isRequired,
isOpen: PropTypes.any,
func: PropTypes.func.isRequired,
tag: PropTypes.string
};
constructor(props) {
super(props);
}
render() {
if (this.props.tag) {
const className = classNames('pane-button', this.props.isOpen && 'active');
return (
<div className={className} onClick={this.props.func.bind(null, this.props.tag)}>{this.props.icon}</div>
);
}
return (
<div className="pane-button" onClick={this.props.func}>{this.props.icon}</div>
);
}
}
export default HeaderButton;
-27
View File
@@ -1,27 +0,0 @@
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
class HeaderDropdown extends Component {
static propTypes = {
className: PropTypes.any,
isOpen: PropTypes.bool.isRequired
};
constructor(props) {
super(props);
}
render() {
const className = classNames('header-dropdown', this.props.className);
return this.props.isOpen ? (
<div className={className}>
{this.props.children}
</div>
) : null;
}
}
export default HeaderDropdown;
-64
View File
@@ -1,64 +0,0 @@
import HeaderButton from './HeaderButton';
import HeaderDropdown from './HeaderDropdown';
import HeroActions from '../../actions/HeroActions';
import HeroesActions from '../../actions/HeroesActions';
import RadioButtonGroup from '../layout/RadioButtonGroup';
import React, { Component, PropTypes } from 'react';
import TextField from '../layout/TextField';
import classNames from 'classnames';
var sortOptions = [
{
name: 'Alphabetisch sortieren',
value: 'name'
},
{
name: 'Nach AP sortieren',
value: 'ap'
}
];
class HeroSectionHeader extends Component {
static propTypes = {
sortBy: PropTypes.string.isRequired
};
state = {
openHeader: false
};
constructor(props) {
super(props);
}
showHeroCreation = () => HeroesActions.showHeroCreation();
openHeader = () => this.setState({ openHeader: !this.state.openHeader });
refresh = () => HeroesActions.refresh();
sort = option => HeroesActions.sort(option);
shouldComponentUpdate(nextProps, nextState) {
return nextState.openHeader !== this.state.openHeader || nextProps.sortBy !== this.props.sortBy;
}
render() {
const className = classNames('header-bar', { 'dropdown-active': this.state.openHeader });
return (
<div className="hero-header">
<div className={className}>
<span>Heldenliste</span>
<HeaderButton icon="add" func={this.showHeroCreation} />
</div>
<HeaderDropdown className="sort-options" isOpen={this.state.openHeader}>
<RadioButtonGroup active={this.props.sortBy} onClick={this.sort} array={sortOptions} />
</HeaderDropdown>
</div>
);
}
}
// <HeaderButton icon="list" func={this.openHeader} isOpen={this.state.openHeader} />
// <HeaderButton icon="refresh" func={this.refresh} />
export default HeroSectionHeader;
-30
View File
@@ -1,30 +0,0 @@
import Avatar from '../layout/Avatar';
import HeroActions from '../../actions/HeroActions';
import React, { Component, PropTypes } from 'react';
class PaneListItem extends Component {
static propTypes = {
id: PropTypes.any.isRequired,
name: PropTypes.string.isRequired,
player: PropTypes.string,
img: PropTypes.string
};
constructor(props) {
super(props);
}
handleClick = () => HeroActions.load(this.props.id);
render() {
return (
<li className="pane-list-item" onClick={this.handleClick}>
<Avatar src={this.props.img} />
<h5 className="name">{this.props.name}{this.props.player ? ' [' + this.props.player + ']' : null}</h5>
</li>
);
}
}
export default PaneListItem;
-62
View File
@@ -1,62 +0,0 @@
import Collapse from '../layout/Collapse';
import HeroListItem from './HeroListItem';
import HeroHeader from './HeroHeader';
import HeroesStore from '../../stores/core/HeroesStore';
import React, { Component } from 'react';
class HeroSection extends Component {
state = {
heroes: HeroesStore.getHeroes(),
sortBy: HeroesStore.getSortOption(),
collapseHeroes: false,
collapseGroups: false
};
constructor(props) {
super(props);
}
_updateHeroesStore = () => this.setState({
heroes: HeroesStore.getHeroes(),
sortBy: HeroesStore.getSortOption()
});
componentDidMount() {
HeroesStore.addChangeListener(this._updateHeroesStore);
}
componentWillUnmount() {
HeroesStore.removeChangeListener(this._updateHeroesStore);
}
switchCollapseHeroes = () => this.setState({ collapseHeroes: !this.state.collapseHeroes});
switchCollapseGroups = () => this.setState({ collapseGroups: !this.state.collapseGroups});
render() {
const heroesListItems = this.state.heroes.length > 0 ? this.state.heroes.map( (hero) => {
return <HeroListItem key={hero.id} id={hero.id} name={hero.name} prof={hero.prof} ap={hero.ap} active={this.props.id} img="" />;
}) : (
<li className="no-heroes">Keine Helden verfügbar.</li>
);
return (
<div className="hero-section">
<HeroHeader sortBy={this.state.sortBy}/>
<Collapse className="heroes" title="Eigene Helden" switch={this.switchCollapseHeroes} expanded={!this.state.collapseHeroes} >
<ul>
{heroesListItems}
</ul>
</Collapse>
<Collapse className="groups" title="Gruppen" switch={this.switchCollapseGroups} expanded={!this.state.collapseGroups} >
<ul>
{heroesListItems}
</ul>
</Collapse>
</div>
);
}
}
export default HeroSection;
-34
View File
@@ -1,34 +0,0 @@
import HeroSection from './HeroSection';
import PaneFooter from './PaneFooter';
import PaneUser from './PaneUser';
import React, { Component, PropTypes } from 'react';
import Scroll from '../layout/Scroll';
class Pane extends Component {
static propTypes = {
user: PropTypes.object.isRequired
};
constructor(props) {
super(props);
}
render() {
const element = this.props.user.id > 0 ? (
<Scroll>
<PaneUser name={this.props.user.name} />
<PaneFooter />
</Scroll>
) : null;
return (
<nav className="pane">
{element}
</nav>
);
}
}
// <HeroSection />
export default Pane;
-20
View File
@@ -1,20 +0,0 @@
import React, { Component } from 'react';
class PaneFooter extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="pane-footer">
<a className="link-button" href="http://forum.dsa-sh.de/index.php?p=/discussions" target="_blank">Forum</a>
<a className="link-button" href="http://forum.dsa-sh.de/index.php?p=/discussion/48/cha5app-wip" target="_blank">Bug melden</a>
<span className="app-version">v0.1-371</span>
</div>
);
}
}
export default PaneFooter;
-22
View File
@@ -1,22 +0,0 @@
import React, { Component, PropTypes } from 'react';
class PaneUser extends Component {
static propTypes = {
name: PropTypes.string
};
constructor(props) {
super(props);
}
render() {
return (
<div className="pane-user">
<h2>{this.props.name}</h2>
</div>
);
}
}
export default PaneUser;
+4 -4
View File
@@ -218,7 +218,7 @@ APStore.dispatchToken = AppDispatcher.register( function( payload ) {
case ActionTypes.DEACTIVATE_SPELL:
case ActionTypes.DEACTIVATE_LITURGY:
AppDispatcher.waitFor([ListStore.dispatchToken]);
_spend(-getIC(ListStore.get(payload.id).skt, 0));
_spend(-(getIC(ListStore.get(payload.id).skt, 0)));
break;
case ActionTypes.ACTIVATE_DISADV:
@@ -236,7 +236,7 @@ APStore.dispatchToken = AppDispatcher.register( function( payload ) {
case ActionTypes.DEACTIVATE_SPECIALABILITY:
AppDispatcher.waitFor([ListStore.dispatchToken]);
_spend(-payload.costs);
_spend(-(payload.costs));
break;
case ActionTypes.ADD_ATTRIBUTE_POINT:
@@ -245,7 +245,7 @@ APStore.dispatchToken = AppDispatcher.register( function( payload ) {
case ActionTypes.ADD_SPELL_POINT:
case ActionTypes.ADD_LITURGY_POINT:
AppDispatcher.waitFor([ListStore.dispatchToken]);
_spend(getIC(ListStore.get(payload.id).skt, ListStore.get(payload.id).value));
_spend(getIC(ListStore.get(payload.id).ic, ListStore.get(payload.id).value));
break;
case ActionTypes.ADD_MAX_ENERGY_POINT:
@@ -259,7 +259,7 @@ APStore.dispatchToken = AppDispatcher.register( function( payload ) {
case ActionTypes.REMOVE_SPELL_POINT:
case ActionTypes.REMOVE_LITURGY_POINT:
AppDispatcher.waitFor([ListStore.dispatchToken]);
_spend(-getIC(ListStore.get(payload.id).skt, ListStore.get(payload.id).value + 1));
_spend(-(getIC(ListStore.get(payload.id).ic, ListStore.get(payload.id).value + 1)));
break;
case ActionTypes.SELECT_RACE:
+3 -3
View File
@@ -66,9 +66,9 @@ AccountStore.dispatchToken = AppDispatcher.register( function( payload ) {
reset();
break;
// case ActionTypes.RECEIVE_RAW_LISTS:
// updateAll(4, 'Elytherion');
// break;
case ActionTypes.RECEIVE_RAW_LISTS:
updateAll(4, 'Elytherion');
break;
default:
return true;
+1 -25
View File
@@ -1,8 +1,6 @@
import AppDispatcher from '../dispatcher/AppDispatcher';
import { EventEmitter } from 'events';
import ELStore from './ELStore';
import ListStore from './ListStore';
import PhaseStore from './PhaseStore';
import RaceStore from './RaceStore';
import ActionTypes from '../constants/ActionTypes';
import Categories from '../constants/Categories';
@@ -85,7 +83,7 @@ var AttributeStore = Object.assign({}, EventEmitter.prototype, {
},
getValue: function(id) {
return this.get(id).value;
return ListStore.get(id).value;
},
getAdd: function(id) {
@@ -100,28 +98,6 @@ var AttributeStore = Object.assign({}, EventEmitter.prototype, {
},
getAllForView: function() {
var phase = PhaseStore.get();
var attrsObj = ListStore.getObjByCategory(CATEGORY);
var attrs = [];
var sum = this.getSum();
for (let id in attrsObj) {
let attr = attrsObj[id];
let { value, mod, dependencies } = attr;
let _max = 25;
if (phase < 3) {
_max = sum >= ELStore.getStart().max_attrsum ? 0 : ELStore.getStart().max_attr + mod;
}
attr.disabledIncrease = value >= _max;
let _min = Math.max(8, ...dependencies);
attr.disabledDecrease = value <= _min;
attrs.push(attr);
}
return ListStore.getAllByCategory(CATEGORY);
},
+7 -37
View File
@@ -51,38 +51,16 @@ var CombatTechniquesStore = Object.assign({}, EventEmitter.prototype, {
return ListStore.get(id);
},
getLeitMod: function(array) {
var max = array.map(attr => this.get(attr).value).reduce((a, b) => Math.max(a, b), 0);
return Math.max(Math.floor((max - 8) / 3), 0);
getMaxPrimaryAttributeValueByID: function(array) {
return array.map(attr => this.get(attr).value).reduce((a, b) => Math.max(a, b), 0);
},
getPrimaryAttributeMod: function(array) {
return Math.max(Math.floor((this.getMaxPrimaryAttributeValueByID(array) - 8) / 3), 0);
},
getAllForView: function() {
var phase = PhaseStore.get();
var combatTechniquesObj = ListStore.getObjByCategory(CATEGORY);
var combatTechniques = [];
var SA_19 = this.get('SA_19').active;
var SA_19_REQ = SA_19 && ListStore.getAllByCategoryGroup(CATEGORY, 2).filter(e => e.value >= 10).length === 1;
for (let id in combatTechniquesObj) {
let combatTechnique = combatTechniquesObj[id];
let { fw, leit, gr, dependencies } = combatTechnique;
let _max = 25;
let _max_bonus = this.get('ADV_17').active.indexOf(id) > -1 ? 1 : 0;
if (phase < 3)
_max = ELStore.getStart().max_combattech + _max_bonus;
else {
let primary = leit.map(e => ListStore.get(e).value);
_max = Math.max(...primary) + 2 + _max_bonus;
}
combatTechnique.disabledIncrease = fw >= _max;
combatTechnique.disabledDecrease = (SA_19_REQ && fw >= 10 && gr === 2) || fw <= Math.max(6, ...dependencies);
combatTechniques.push(combatTechnique);
}
var combatTechniques = ListStore.getAllByCategory(CATEGORY);
if (_filter !== '') {
let filter = _filter.toLowerCase();
combatTechniques = combatTechniques.filter(obj => obj.name.toLowerCase().match(filter));
@@ -114,14 +92,6 @@ var CombatTechniquesStore = Object.assign({}, EventEmitter.prototype, {
}
});
}
for (let i = 0; i < combatTechniques.length; i++) {
if (combatTechniques[i].gr === 2) {
combatTechniques[i].at = combatTechniques[i].value + this.getLeitMod(combatTechniques[i].leit);
} else {
combatTechniques[i].at = combatTechniques[i].value + this.getLeitMod(['ATTR_1']);
combatTechniques[i].pa = Math.round(combatTechniques[i].value / 2) + this.getLeitMod(combatTechniques[i].leit);
}
}
return combatTechniques;
},
+55 -31
View File
@@ -4,6 +4,11 @@ import CultureStore from './CultureStore';
import ProfessionStore from './ProfessionStore';
import ProfessionVariantStore from './ProfessionVariantStore';
import RaceStore from './RaceStore';
import Attribute from './data/Attribute';
import CombatTechnique from './data/CombatTechnique';
import Liturgy from './data/Liturgy';
import Spell from './data/Spell';
import Talent from './data/Talent';
import ActionTypes from '../constants/ActionTypes';
import Categories from '../constants/Categories';
import iccalc from '../utils/iccalc';
@@ -19,19 +24,19 @@ function _deactivate(id) {
}
function _addPoint(id) {
_list[id].value++;
_list[id].addPoint();
}
function _removePoint(id) {
_list[id].value--;
_list[id].removePoint();
}
function _setValue(id, value) {
_list[id].value = value;
_list[id].set(value);
}
function _addSR(id, amount) {
_list[id].value += amount;
_list[id].add(amount);
}
function _addDependencies(reqs, sel) {
@@ -68,11 +73,13 @@ function _removeDependencies(reqs, sel) {
if (id === 'auto_req' || option === 'TAL_GR_2') return;
else if (id === 'ATTR_PRIMARY') {
id = this.getPrimaryAttrID(option);
for (let i = 0; i < _list[id].dependencies.length; i++)
if (_list[id].dependencies[i] === value) {
_list[id].dependencies.some((e, i) => {
if (e === value) {
_list[id].dependencies.splice(i, 1);
break;
return true;
}
return false;
});
}
else {
let sid;
@@ -258,38 +265,53 @@ function _updateTier(id, tier, sid) {
function _init({ attributes, adv, disadv, talents, combattech, spells, liturgies, specialabilities }) {
for (let id in attributes) {
_list[id] = attributes[id];
_list[id].category = Categories.ATTRIBUTES;
_list[id].dependencies = [];
_list[id] = new Attribute(attributes[id]);
}
for (let id in talents) {
_list[id] = talents[id];
_list[id].value = 0;
_list[id].category = Categories.TALENTS;
_list[id].dependencies = [];
_list[id] = new Talent(talents[id]);
}
for (let id in combattech) {
_list[id] = combattech[id];
_list[id].value = 6;
_list[id].category = Categories.COMBAT_TECHNIQUES;
_list[id].dependencies = [];
_list[id] = new CombatTechnique(combattech[id]);
}
for (let id in spells) {
_list[id] = spells[id];
_list[id].value = 0;
_list[id].check = _list[id].check.map((e,i) => i < 3 ? `ATTR_${e}` : e);
_list[id].active = false;
_list[id].category = Categories.SPELLS;
_list[id].dependencies = [];
_list[id] = new Spell(spells[id]);
}
for (let id in liturgies) {
_list[id] = liturgies[id];
_list[id].value = 0;
_list[id].check = _list[id].check.map((e,i) => i < 3 ? `ATTR_${e}` : e);
_list[id].active = false;
_list[id].category = Categories.CHANTS;
_list[id].dependencies = [];
_list[id] = new Liturgy(liturgies[id]);
}
// for (let id in attributes) {
// _list[id] = attributes[id];
// _list[id].category = Categories.ATTRIBUTES;
// _list[id].dependencies = [];
// }
// for (let id in talents) {
// _list[id] = talents[id];
// _list[id].value = 0;
// _list[id].category = Categories.TALENTS;
// _list[id].dependencies = [];
// }
// for (let id in combattech) {
// _list[id] = combattech[id];
// _list[id].value = 6;
// _list[id].category = Categories.COMBAT_TECHNIQUES;
// _list[id].dependencies = [];
// }
// for (let id in spells) {
// _list[id] = spells[id];
// _list[id].value = 0;
// _list[id].check = _list[id].check.map((e,i) => i < 3 ? `ATTR_${e}` : e);
// _list[id].active = false;
// _list[id].category = Categories.SPELLS;
// _list[id].dependencies = [];
// }
// for (let id in liturgies) {
// _list[id] = liturgies[id];
// _list[id].value = 0;
// _list[id].check = _list[id].check.map((e,i) => i < 3 ? `ATTR_${e}` : e);
// _list[id].active = false;
// _list[id].category = Categories.CHANTS;
// _list[id].dependencies = [];
// }
for (let id in adv) {
adv[id].category = Categories.ADVANTAGES;
}
@@ -575,6 +597,8 @@ function _clear() {
}
}
}
export const get = id => _list[id];
var ListStore = Object.assign({}, EventEmitter.prototype, {
@@ -744,7 +768,7 @@ ListStore.dispatchToken = AppDispatcher.register( function( payload ) {
case ActionTypes.ADD_SPELL_POINT:
case ActionTypes.ADD_LITURGY_POINT:
if (iccalc(_list[payload.id].skt, _list[payload.id].value + 1)) {
_activate(payload.id);
_addPoint(payload.id);
}
break;
+19 -66
View File
@@ -86,78 +86,31 @@ var LiturgiesStore = Object.assign({}, EventEmitter.prototype, {
return ListStore.get(id);
},
getActiveForView: function() {
var phase = PhaseStore.get();
var liturgiesObj = ListStore.getObjByCategory(CATEGORY);
var liturgies = [];
var SA_103_ACTIVE = this.get('SA_103').active;
var liturgiesAbove10 = ListStore.getAllByCategory(CATEGORY).filter(e => e.value >= 10);
var counter = {};
liturgiesAbove10.forEach(n => {
n.aspc.forEach(e => {
if (!counter.hasOwnProperty(e))
counter[e] = 1;
else
counter[e]++;
});
});
for (let id in liturgiesObj) {
let liturgy = liturgiesObj[id];
let { active, fw, aspc, trad, gr } = liturgy;
if (!active) continue;
var available = trad.some(e => e === 1 || e === ListStore.get('SA_102').sid + 1);
if (!available) continue;
let _max = 25;
let _max_bonus = this.get('ADV_16').active.filter(e => e === id).length;
if (phase < 3)
_max = ELStore.getStart().max_skill + _max_bonus;
else {
let checkValues = liturgy.check.map(attr => ListStore.get(attr).value);
_max = Math.max(...checkValues) + 2 + _max_bonus;
getAspectCounter: function() {
return ListStore.getAllByCategory(CATEGORY).filter(e => e.value >= 10).reduce((a,b) => {
if (!a.has(b.aspect)) {
a.set(b.aspect, 1);
} else {
a.set(b.aspect, a.get(b.aspect) + 1);
}
aspc.some(e => {
if (SA_103_ACTIVE.indexOf(e) === -1) {
_max = Math.min(14, _max);
return true;
}
else return false;
});
liturgy.disabledIncrease = fw >= _max;
}, new Map());
},
aspc.some(e => {
if (SA_103_ACTIVE.indexOf(e) > -1 && counter[e] <= 3 && gr !== 3) {
liturgy.disabledDecrease = fw <= 10;
return true;
}
else return false;
});
liturgies.push(liturgy);
}
getActiveForView: function() {
var liturgies = ListStore.getAllByCategory(CATEGORY).filter(e => e.active);
return _filterAndSort(liturgies);
},
getDeactiveForView: function() {
var liturgiesObj = ListStore.getObjByCategory(CATEGORY);
var liturgies = [];
for (let id in liturgiesObj) {
let liturgy = liturgiesObj[id];
let { active, trad } = liturgy;
if (active) continue;
var available = trad.some(e => e === 1 || e === ListStore.get('SA_102').sid + 1);
if (!available) continue;
liturgies.push(liturgy);
}
var liturgies = ListStore.getObjByCategory(CATEGORY).filter(e => {
if (!e.active) {
if (!e.isOwnTradition) {
return false;
}
return true;
}
return false;
});
return _filterAndSort(liturgies);
},
+28 -71
View File
@@ -106,86 +106,43 @@ var SpellsStore = Object.assign({}, EventEmitter.prototype, {
return ListStore.get(id);
},
getPropertyCounter: function() {
return ListStore.getAllByCategory(CATEGORY).filter(e => e.value >= 10).reduce((a,b) => {
if (!a.has(b.property)) {
a.set(b.property, 1);
} else {
a.set(b.property, a.get(b.property) + 1);
}
}, new Map());
},
getActiveForView: function() {
var phase = PhaseStore.get();
var spellsObj = ListStore.getObjByCategory(CATEGORY);
var spells = [];
var SA_88_ACTIVE = this.get('SA_88').active;
var spellsAbove10 = ListStore.getAllByCategory(CATEGORY).filter(e => e.value >= 10);
var counter = {};
for (let i = 0; i < spellsAbove10.length; i++) {
let spell = spellsAbove10[i];
if (!counter.hasOwnProperty(spell.merk))
counter[spell.merk] = 1;
else
counter[spell.merk]++;
}
for (let id in spellsObj) {
let spell = spellsObj[id];
let { active, fw, merk, trad, gr } = spell;
if (!active) continue;
var available = trad.some(e => e === 1 || e === ListStore.get('SA_86').sid + 1);
if (!available) {
if (gr > 2)
continue;
else
spell.add = trad.map(e => TRADITIONS[e - 1]).join(', ');
}
spell.ownTradition = available;
let _max = 25;
let _max_bonus = this.get('ADV_16').active.filter(e => e === id).length;
if (phase < 3)
_max = ELStore.getStart().max_skill + _max_bonus;
else {
let checkValues = spell.check.map(attr => ListStore.get(attr).value);
_max = Math.max(...checkValues) + 2 + _max_bonus;
}
if (SA_88_ACTIVE.indexOf(merk) === -1)
_max = Math.min(14, _max);
spell.disabledIncrease = fw >= _max;
if (SA_88_ACTIVE.indexOf(merk) > -1)
spell.disabledDecrease = counter[merk] <= 3 && fw === 10 && gr !== 5;
spells.push(spell);
}
var spells = ListStore.getAllByCategory(CATEGORY).filter(e => e.active);
return _filterAndSort(spells);
},
getDeactiveForView: function() {
var spellsObj = ListStore.getObjByCategory(CATEGORY);
var spells = [];
const maxUnfamiliar = PhaseStore.get() < 3 && ListStore.getAllByCategory(CATEGORY).filter(e =>
!e.trad.some(e =>
e === 1 ||
e === ListStore.get('SA_86').sid + 1
) && e.gr < 3 && e.active
).length >= ELStore.getStart().max_unfamiliar_spells;
for (let id in spellsObj) {
let spell = spellsObj[id];
let { active, trad, gr } = spell;
!e.tradition.some(e =>
e === 1 ||
e === ListStore.get('SA_86').sid + 1
) && e.gr < 3 && e.active
).length >= ELStore.getStart().max_unfamiliar_spells;
if (active) continue;
var available = trad.some(e => e === 1 || e === ListStore.get('SA_86').sid + 1);
if (!available) {
if (gr > 2 || maxUnfamiliar) {
continue;
} else {
spell.add = trad.map(e => TRADITIONS[e - 1]).join(', ');
var spells = ListStore.getAllByCategory(CATEGORY).filter(e => {
if (!e.active) {
if (!e.isOwnTradition) {
if (e.gr > 2 || maxUnfamiliar) {
return false;
} else {
e.name_add = e.tradition.map(e => TRADITIONS[e - 1]).join(', ');
return true;
}
}
return true;
}
spell.ownTradition = available;
spells.push(spell);
}
return false;
});
return _filterAndSort(spells);
},
+1 -1
View File
@@ -4,7 +4,7 @@ import ActionTypes from '../constants/ActionTypes';
import AccountStore from './AccountStore';
import PhaseStore from './PhaseStore';
var _currentTab = 'home';
var _currentTab = 'herolist';
var _currentSection = 'main';
function _updateTab(tab) {
+31
View File
@@ -0,0 +1,31 @@
import Increasable from './Increasable';
import AttributeStore from '../AttributeStore';
import ELStore from '../ELStore';
import PhaseStore from '../PhaseStore';
import Categories from '../../constants/Categories';
export default class Attribute extends Increasable {
constructor(args) {
super(args);
let { short } = args;
this.short = short;
this.value = 8;
this.mod = 0;
this.ic = 5;
this.category = Categories.ATTRIBUTES;
}
get isIncreasable() {
if (PhaseStore.get() < 3) {
let max = AttributeStore.getSum() >= ELStore.getStart().max_attrsum ? 0 : ELStore.getStart().max_attr + this.mod;
return this.value < max;
} else {
return true;
}
}
get isDecreasable() {
return this.value > Math.max(8, ...(this.dependencies));
}
}
+49
View File
@@ -0,0 +1,49 @@
import Increasable from './Increasable';
import CombatTechniquesStore from '../CombatTechniquesStore';
import ELStore from '../ELStore';
import ListStore, { get } from '../ListStore';
import PhaseStore from '../PhaseStore';
import Categories from '../../constants/Categories';
export default class CombatTechnique extends Increasable {
constructor(args) {
super(args);
let { skt, gr, leit } = args;
this.ic = skt;
this.gr = gr;
this.primary = leit;
this.value = 6;
this.category = Categories.COMBAT_TECHNIQUES;
}
get at() {
let array = this.gr === 2 ? this.primary : ['ATTR_1'];
let mod = CombatTechniquesStore.getPrimaryAttributeMod(array);
return this.value + mod;
}
get pa() {
let mod = CombatTechniquesStore.getPrimaryAttributeMod(this.primary);
return this.gr === 2 ? '--' : Math.round(this.value / 2) + mod;
}
get isIncreasable() {
let max = 0;
let bonus = get('ADV_17').active.indexOf(this.id) > -1 ? 1 : 0;
if (PhaseStore.get() < 3) {
max = ELStore.getStart().max_combattech;
} else {
max = CombatTechniquesStore.getMaxPrimaryAttributeValueByID(this.primary) + 2;
}
return this.value < max + bonus;
}
get isDecreasable() {
var SA_19_REQ = get('SA_19').active && ListStore.getAllByCategoryGroup(this.category, 2).filter(e => e.value >= 10).length === 1;
return (SA_19_REQ && this.value > 10 && this.gr === 2) || this.value > Math.max(6, ...(this.dependencies));
}
}
+7
View File
@@ -0,0 +1,7 @@
export default class Core {
constructor(args) {
let { id, name } = args;
this.id = id;
this.name = name;
}
}
+21
View File
@@ -0,0 +1,21 @@
import Core from './Core';
export default class Dependent extends Core {
constructor(args) {
super(args);
this.dependencies = [];
}
addDependency(obj) {
this.dependencies.push(obj);
}
removeDependency(obj) {
let index = this.dependencies.indexOf(obj);
if (index > -1) {
this.dependencies.splice(index, 1);
return true;
}
return false;
}
}
+28
View File
@@ -0,0 +1,28 @@
import Dependent from './Dependent';
export default class Increasable extends Dependent {
constructor(args) {
super(args);
this.value = 0;
}
set(value) {
this.value = value;
}
add(value) {
this.value += value;
}
remove(value) {
this.value -= value;
}
addPoint() {
this.value += 1;
}
removePoint() {
this.value -= 1;
}
}
+10
View File
@@ -0,0 +1,10 @@
import Core from './Core';
export default class Item extends Core {
constructor(args) {
super(args);
let { price, weight } = args;
this.price = price;
this.weight = weight;
}
}
+50
View File
@@ -0,0 +1,50 @@
import Skill from './Skill';
import ELStore from '../ELStore';
import { get } from '../ListStore';
import LiturgiesStore from '../LiturgiesStore';
import PhaseStore from '../PhaseStore';
import Categories from '../../constants/Categories';
export default class Spell extends Skill {
constructor(args) {
super(args);
let { trad, aspc } = args;
this.check = this.check.map((e,i) => i < 3 ? `ATTR_${e}` : e);
this.tradition = trad;
this.aspect = aspc;
this.active = false;
this.category = Categories.CHANTS;
}
get isOwnTradition() {
return this.tradition.some(e => e === 1 || e === get('SA_86').sid + 1);
}
get isIncreasable() {
let max = 0;
let bonus = get('ADV_16').active.filter(e => e === this.id).length;
if (PhaseStore.get() < 3) {
max = ELStore.getStart().max_skill;
} else {
let checkValues = this.check.map(attr => get(attr).value);
max = Math.max(...checkValues) + 2;
}
if (get('SA_103').active.indexOf(this.aspect) === -1) {
max = Math.min(14, max);
}
return this.value < max + bonus;
}
get isDecreasable() {
if (get('SA_103').active.indexOf(this.aspect) > -1) {
const counter = LiturgiesStore.getAspectCounter();
return !(counter.get(this.aspect) <= 3 && this.value <= 10 && this.gr !== 5);
}
return true;
}
}
+11
View File
@@ -0,0 +1,11 @@
import Increasable from './Increasable';
export default class Skill extends Increasable {
constructor(args) {
super(args);
let { check, skt, gr } = args;
this.check = check;
this.ic = skt;
this.gr = gr;
}
}
+49
View File
@@ -0,0 +1,49 @@
import Skill from './Skill';
import ELStore from '../ELStore';
import { get } from '../ListStore';
import PhaseStore from '../PhaseStore';
import SpellsStore from '../SpellsStore';
import Categories from '../../constants/Categories';
export default class Spell extends Skill {
constructor(args) {
super(args);
let { trad, merk } = args;
this.check = this.check.map((e,i) => i < 3 ? `ATTR_${e}` : e);
this.tradition = trad;
this.property = merk;
this.active = false;
this.category = Categories.SPELLS;
}
get isOwnTradition() {
return this.tradition.some(e => e === 1 || e === get('SA_86').sid + 1);
}
get isIncreasable() {
let max = 0;
let bonus = get('ADV_16').active.filter(e => e === this.id).length;
if (PhaseStore.get() < 3) {
max = ELStore.getStart().max_skill;
} else {
let checkValues = this.check.map(attr => get(attr).value);
max = Math.max(...checkValues) + 2;
}
if (get('SA_88').active.indexOf(this.property) === -1) {
max = Math.min(14, max);
}
return this.value < max + bonus;
}
get isDecreasable() {
if (get('SA_88').active.indexOf(this.property) > -1) {
const counter = SpellsStore.getPropertyCounter();
return !(counter.get(this.property) <= 3 && this.value <= 10 && this.gr !== 5);
}
}
}
+48
View File
@@ -0,0 +1,48 @@
import Skill from './Skill';
import CultureStore from '../CultureStore';
import ELStore from '../ELStore';
import { get } from '../ListStore';
import PhaseStore from '../PhaseStore';
import Categories from '../../constants/Categories';
export default class Talent extends Skill {
constructor(args) {
super(args);
let { enc, spec, spec_input } = args;
this.enc = enc;
this.spec = spec;
this.spec_input = spec_input;
this.category = Categories.TALENTS;
}
get isIncreasable() {
let max = 0;
let bonus = get('ADV_16').active.filter(e => e === this.id).length;
if (PhaseStore.get() < 3) {
max = ELStore.getStart().max_skill;
} else {
let checkValues = this.check.map(attr => get(attr).value);
max = Math.max(...checkValues) + 2;
}
return this.value < max + bonus;
}
get isDecreasable() {
var SA_18_REQ = get('SA_18').active && get('TAL_51').value + get('TAL_55').value < 12;
return (['TAL_51','TAL_55'].indexOf(this.id) > -1 && SA_18_REQ) || this.value > Math.max(0, ...(this.dependencies));
}
get isTyp() {
const culture = CultureStore.getCurrent();
return culture.typ_talents.indexOf(this.id) > -1;
}
get isUntyp() {
const culture = CultureStore.getCurrent();
return culture.untyp_talents.indexOf(this.id) > -1;
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
import createOverlay from './createOverlay';
import Dialog from '../components/layout/Dialog';
import Dialog from '../components/Dialog';
import React from 'react';
export default function(title, content, buttons) {
+45
View File
@@ -0,0 +1,45 @@
import About from './about/About';
import Account from './account/Account';
import Attribute from './attributes/AttributesController';
import DisAdv from './disadv/DisAdv';
import Grouplist from './grouplist/Grouplist';
import Herolist from './herolist/Herolist';
import Home from './home/Home';
import Items from './items/Items';
import Master from './master/Master';
import Profile from './profile/Profile';
import React from 'react';
import RCP from './rcp/RCP';
import Skills from './skills/Skills';
export default props => {
const { id } = props;
switch (id) {
case 'home':
return <Home />;
case 'herolist':
return <Herolist />;
case 'grouplist':
return <Grouplist />;
case 'account':
return <Account />;
case 'about':
return <About />;
case 'rcp':
return <RCP />;
case 'profile':
return <Profile />;
case 'attributes':
return <Attribute />;
case 'disadv':
return <DisAdv />;
case 'skills':
return <Skills />;
case 'items':
return <Items />;
case 'master':
return <Master />;
default:
return null;
}
};
@@ -1,9 +1,11 @@
import Content from './content/Content';
import React, { Component } from 'react';
import Route from './Route';
import TabStore from '../stores/TabStore';
import TitleBar from './TitleBar';
import Wait from './Wait';
import WaitStore from '../stores/WaitStore';
class AppController extends Component {
class Router extends Component {
state = {
section: TabStore.getCurrentSID(),
@@ -11,10 +13,6 @@ class AppController extends Component {
wait: WaitStore.getWaiting()
};
constructor(props) {
super(props);
}
_updateTabStore = () => this.setState({ section: TabStore.getCurrentSID(), tab: TabStore.getCurrentID() });
_updateWaitStore = () => this.setState({ wait: WaitStore.getWaiting() });
@@ -32,17 +30,16 @@ class AppController extends Component {
const { section, tab, wait } = this.state;
const waitElement = wait ? (
<div className="wait"><div></div></div>
) : null;
return (
<div id="body">
{waitElement}
<Content tab={tab} section={section} />
<Wait show={wait} />
<main>
<TitleBar section={section} tab={tab} />
<Route id={tab} />
</main>
</div>
);
}
}
export default AppController;
export default Router;
@@ -1,17 +1,15 @@
import AccountActions from '../../actions/AccountActions';
import AccountStore from '../../stores/AccountStore';
import APStore from '../../stores/APStore';
import Avatar from './Avatar';
import BorderButton from './BorderButton';
import ELStore from '../../stores/ELStore';
import HerolistActions from '../../actions/HerolistActions';
import IconButton from './IconButton';
import InGameActions from '../../actions/InGameActions';
import PhaseStore from '../../stores/PhaseStore';
import ProfileStore from '../../stores/ProfileStore';
import AccountActions from '../actions/AccountActions';
import AccountStore from '../stores/AccountStore';
import APStore from '../stores/APStore';
import BorderButton from '../components/BorderButton';
import ELStore from '../stores/ELStore';
import HerolistActions from '../actions/HerolistActions';
import IconButton from '../components/IconButton';
import InGameActions from '../actions/InGameActions';
import PhaseStore from '../stores/PhaseStore';
import ProfileStore from '../stores/ProfileStore';
import React, { Component, PropTypes } from 'react';
import Tab from './Tab';
import TabActions from '../../actions/TabActions';
import TabActions from '../actions/TabActions';
import TitleBarArrow from './TitleBarArrow';
import TitleBarNav from './TitleBarNav';
@@ -6,10 +6,6 @@ class TitleBarArrow extends Component {
onClick: PropTypes.func.isRequired
};
constructor(props) {
super(props);
}
render() {
return (
<svg width="19px" height="19px" onClick={this.props.onClick} >
@@ -1,7 +1,7 @@
import Avatar from './Avatar';
import Avatar from '../components/Avatar';
import React, { Component, PropTypes } from 'react';
import Tab from './Tab';
import TabActions from '../../actions/TabActions';
import Tab from '../components/Tab';
import TabActions from '../actions/TabActions';
import classNames from 'classnames';
class TitleBarNav extends Component {
@@ -11,10 +11,6 @@ class TitleBarNav extends Component {
tabs: PropTypes.array.isRequired
};
constructor(props) {
super(props);
}
handleClick = tab => TabActions.openTab(tab);
render() {
+3
View File
@@ -0,0 +1,3 @@
import React from 'react';
export default props => props.show ? <div className="wait"><div></div></div> : null;
@@ -1,6 +1,6 @@
import VersionStore from '../../../stores/VersionStore';
import VersionStore from '../../stores/VersionStore';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
import Scroll from '../../components/Scroll';
class About extends Component {
@@ -1,10 +1,10 @@
import AccountActions from '../../../actions/AccountActions';
import BorderButton from '../../layout/BorderButton';
import IconButton from '../../layout/IconButton';
import AccountActions from '../../actions/AccountActions';
import BorderButton from '../../components/BorderButton';
import IconButton from '../../components/IconButton';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
import TextField from '../../layout/TextField';
import TextFieldButtonGroup from '../../layout/TextFieldButtonGroup';
import Scroll from '../../components/Scroll';
import TextField from '../../components/TextField';
import TextFieldButtonGroup from '../../components/TextFieldButtonGroup';
class Account extends Component {
@@ -1,8 +1,8 @@
import AccountActions from '../../../actions/AccountActions';
import Dialog from '../../layout/Dialog';
import AccountActions from '../../actions/AccountActions';
import Dialog from '../../components/Dialog';
import React, { Component, PropTypes } from 'react';
import TextField from '../../layout/TextField';
import { close } from '../../../utils/createOverlay';
import TextField from '../../components/TextField';
import { close } from '../../utils/createOverlay';
class ForgotPassword extends Component {
@@ -1,8 +1,8 @@
import AccountActions from '../../../actions/AccountActions';
import Dialog from '../../layout/Dialog';
import AccountActions from '../../actions/AccountActions';
import Dialog from '../../components/Dialog';
import React, { Component, PropTypes } from 'react';
import TextField from '../../layout/TextField';
import { close } from '../../../utils/createOverlay';
import TextField from '../../components/TextField';
import { close } from '../../utils/createOverlay';
class ForgotUsername extends Component {
@@ -1,8 +1,8 @@
import AccountActions from '../../../actions/AccountActions';
import Dialog from '../../layout/Dialog';
import AccountActions from '../../actions/AccountActions';
import Dialog from '../../components/Dialog';
import React, { Component, PropTypes } from 'react';
import TextField from '../../layout/TextField';
import { close } from '../../../utils/createOverlay';
import TextField from '../../components/TextField';
import { close } from '../../utils/createOverlay';
class Login extends Component {
@@ -1,8 +1,8 @@
import AccountActions from '../../../actions/AccountActions';
import Dialog from '../../layout/Dialog';
import AccountActions from '../../actions/AccountActions';
import Dialog from '../../components/Dialog';
import React, { Component, PropTypes } from 'react';
import TextField from '../../layout/TextField';
import { close } from '../../../utils/createOverlay';
import TextField from '../../components/TextField';
import { close } from '../../utils/createOverlay';
function _validateEmail(email) {
var regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
@@ -1,4 +1,4 @@
import TabActions from '../../../actions/TabActions';
import TabActions from '../../actions/TabActions';
import React, { Component } from 'react';
class RegistrationConfirm extends Component {
@@ -1,8 +1,8 @@
import AccountActions from '../../../actions/AccountActions';
import Dialog from '../../layout/Dialog';
import AccountActions from '../../actions/AccountActions';
import Dialog from '../../components/Dialog';
import React, { Component, PropTypes } from 'react';
import TextField from '../../layout/TextField';
import { close } from '../../../utils/createOverlay';
import TextField from '../../components/TextField';
import { close } from '../../utils/createOverlay';
class ResendActivation extends Component {
@@ -1,6 +1,6 @@
import AttributeCalcItem from './AttributeCalcItem';
import AttributeStore from '../../../stores/AttributeStore';
import ListStore from '../../../stores/ListStore';
import AttributeStore from '../../stores/AttributeStore';
import ListStore from '../../stores/ListStore';
import React, { Component, PropTypes } from 'react';
class AttributeCalc extends Component {
@@ -1,6 +1,6 @@
import AttributeActions from '../../../actions/AttributeActions';
import AttributeActions from '../../actions/AttributeActions';
import AttributeBorder from './AttributeBorder';
import IconButton from '../../layout/IconButton';
import IconButton from '../../components/IconButton';
import React, { Component, PropTypes } from 'react';
class AttributeCalcItem extends Component {
@@ -1,6 +1,6 @@
import AttributeActions from '../../../actions/AttributeActions';
import AttributeActions from '../../actions/AttributeActions';
import AttributeBorder from './AttributeBorder';
import IconButton from '../../layout/IconButton';
import IconButton from '../../components/IconButton';
import React, { Component, PropTypes } from 'react';
class AttributeListItem extends Component {
@@ -15,13 +15,13 @@ class AttributeListItem extends Component {
render() {
const { attribute: { id, short, value, disabledIncrease, disabledDecrease }, phase } = this.props;
const { attribute: { id, short, value, isIncreasable, isDecreasable }, phase } = this.props;
return (
<AttributeBorder className={id} label={short} value={value}>
<IconButton className="add" icon="&#xE145;" onClick={this.addPoint} disabled={disabledIncrease} />
<IconButton className="add" icon="&#xE145;" onClick={this.addPoint} disabled={!isIncreasable} />
{ phase < 3 ? (
<IconButton className="remove" icon="&#xE15B;" onClick={this.removePoint} disabled={disabledDecrease} />
<IconButton className="remove" icon="&#xE15B;" onClick={this.removePoint} disabled={!isDecreasable} />
) : null }
</AttributeBorder>
);
@@ -1,10 +1,10 @@
import AttributeCalc from './AttributeCalc';
import AttributeList from './AttributeList';
import AttributeStore from '../../../stores/AttributeStore';
import ELStore from '../../../stores/ELStore';
import PhaseStore from '../../../stores/PhaseStore';
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';
import Scroll from '../../components/Scroll';
class Attribute extends Component {
@@ -0,0 +1,43 @@
import Attributes from './Attributes';
import AttributeStore from '../../stores/AttributeStore';
import ELStore from '../../stores/ELStore';
import PhaseStore from '../../stores/PhaseStore';
import React, { Component } from 'react';
class AttributesController extends Component {
state = {
attributes: AttributeStore.getAllForView(),
baseValues: AttributeStore.getBaseValues(),
el: ELStore.getStart(),
phase: PhaseStore.get(),
sum: AttributeStore.getSum()
};
_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() {
return (
<Attributes {...this.state} />
);
}
}
export default AttributesController;
@@ -1,14 +1,14 @@
import BorderButton from '../../layout/BorderButton';
import Checkbox from '../../layout/Checkbox';
import CultureStore from '../../../stores/CultureStore';
import DisAdvActions from '../../../actions/DisAdvActions';
import BorderButton from '../../components/BorderButton';
import Checkbox from '../../components/Checkbox';
import CultureStore from '../../stores/CultureStore';
import DisAdvActions from '../../actions/DisAdvActions';
import DisAdvList from './DisAdvList';
import DisAdvStore from '../../../stores/DisAdvStore';
import ProfessionStore from '../../../stores/ProfessionStore';
import RaceStore from '../../../stores/RaceStore';
import DisAdvStore from '../../stores/DisAdvStore';
import ProfessionStore from '../../stores/ProfessionStore';
import RaceStore from '../../stores/RaceStore';
import React, { Component } from 'react';
import Slidein from '../../layout/Slidein';
import TextField from '../../layout/TextField';
import Slidein from '../../components/Slidein';
import TextField from '../../components/TextField';
class Advantages extends Component {
@@ -22,10 +22,6 @@ class Advantages extends Component {
culture: CultureStore.getCurrent(),
profession: ProfessionStore.getCurrent()
};
constructor(props) {
super(props);
}
_updateDisAdvStore = () => this.setState({
filter: DisAdvStore.getFilter(),
@@ -1,9 +1,9 @@
import Advantages from './Advantages';
import BorderButton from '../../layout/BorderButton';
import BorderButton from '../../components/BorderButton';
import Disadvantages from './Disadvantages';
import React from 'react';
import SubTabs from '../../layout/SubTabs';
import TextField from '../../layout/TextField';
import SubTabs from '../../components/SubTabs';
import TextField from '../../components/TextField';
import classNames from 'classnames';
class DisAdv extends React.Component {
@@ -12,10 +12,6 @@ class DisAdv extends React.Component {
tab: 'adv'
};
constructor(props) {
super(props);
}
handleClick = tab => this.setState({ tab });
render() {
@@ -1,9 +1,9 @@
import BorderButton from '../../layout/BorderButton';
import DisAdvActions from '../../../actions/DisAdvActions';
import DisAdvStore from '../../../stores/DisAdvStore';
import Dropdown from '../../layout/Dropdown';
import BorderButton from '../../components/BorderButton';
import DisAdvActions from '../../actions/DisAdvActions';
import DisAdvStore from '../../stores/DisAdvStore';
import Dropdown from '../../components/Dropdown';
import React, { Component, PropTypes } from 'react';
import TextField from '../../layout/TextField';
import TextField from '../../components/TextField';
class DisAdvAddListItem extends Component {
@@ -19,10 +19,6 @@ class DisAdvAddListItem extends Component {
input2: ''
};
constructor(props) {
super(props);
}
handleSelect = selected => this.setState({ selected });
handleSelectTier = selected_tier => {
if (['DISADV_34','DISADV_50'].indexOf(this.props.item.id) > -1) {
@@ -1,7 +1,7 @@
import DisAdvAddListItem from './DisAdvAddListItem';
import DisAdvRemoveListItem from './DisAdvRemoveListItem';
import React, { Component, PropTypes } from 'react';
import Scroll from '../../layout/Scroll';
import Scroll from '../../components/Scroll';
import classNames from 'classnames';
class DisAdvList extends Component {
@@ -14,10 +14,6 @@ class DisAdvList extends Component {
type: PropTypes.string
};
constructor(props) {
super(props);
}
render() {
const { active, list, rating, showRating, type } = this.props;
@@ -1,18 +1,14 @@
import BorderButton from '../../layout/BorderButton';
import DisAdvActions from '../../../actions/DisAdvActions';
import Dropdown from '../../layout/Dropdown';
import BorderButton from '../../components/BorderButton';
import DisAdvActions from '../../actions/DisAdvActions';
import Dropdown from '../../components/Dropdown';
import React, { Component, PropTypes } from 'react';
import TextField from '../../layout/TextField';
import TextField from '../../components/TextField';
class DisAdvRemoveListItem extends Component {
static propTypes = {
item: PropTypes.object
};
constructor(props) {
super(props);
}
handleSelectTier = selected_tier => {
var disadv = this.props.item;
@@ -1,14 +1,14 @@
import BorderButton from '../../layout/BorderButton';
import Checkbox from '../../layout/Checkbox';
import CultureStore from '../../../stores/CultureStore';
import DisAdvActions from '../../../actions/DisAdvActions';
import BorderButton from '../../components/BorderButton';
import Checkbox from '../../components/Checkbox';
import CultureStore from '../../stores/CultureStore';
import DisAdvActions from '../../actions/DisAdvActions';
import DisAdvList from './DisAdvList';
import DisAdvStore from '../../../stores/DisAdvStore';
import ProfessionStore from '../../../stores/ProfessionStore';
import RaceStore from '../../../stores/RaceStore';
import DisAdvStore from '../../stores/DisAdvStore';
import ProfessionStore from '../../stores/ProfessionStore';
import RaceStore from '../../stores/RaceStore';
import React, { Component } from 'react';
import Slidein from '../../layout/Slidein';
import TextField from '../../layout/TextField';
import Slidein from '../../components/Slidein';
import TextField from '../../components/TextField';
class Disadvantages extends Component {
@@ -22,10 +22,6 @@ class Disadvantages extends Component {
culture: CultureStore.getCurrent(),
profession: ProfessionStore.getCurrent()
};
constructor(props) {
super(props);
}
_updateDisAdvStore = () => this.setState({
filter: DisAdvStore.getFilter(),
@@ -1,16 +1,12 @@
import BorderButton from '../../layout/BorderButton';
import RadioButtonGroup from '../../layout/RadioButtonGroup';
import BorderButton from '../../components/BorderButton';
import RadioButtonGroup from '../../components/RadioButtonGroup';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
import TabActions from '../../../actions/TabActions';
import TextField from '../../layout/TextField';
import Scroll from '../../components/Scroll';
import TabActions from '../../actions/TabActions';
import TextField from '../../components/TextField';
class Grouplist extends Component {
constructor(props) {
super(props);
}
filter = event => event.target.value;
openGroup = () => TabActions.showSection('group');
@@ -1,8 +1,8 @@
import Dialog from '../../layout/Dialog';
import Dropdown from '../../layout/Dropdown';
import HerolistActions from '../../../actions/HerolistActions';
import Dialog from '../../components/Dialog';
import Dropdown from '../../components/Dropdown';
import HerolistActions from '../../actions/HerolistActions';
import React, { Component, PropTypes } from 'react';
import TextField from '../../layout/TextField';
import TextField from '../../components/TextField';
class HeroCreation extends Component {
@@ -16,10 +16,6 @@ class HeroCreation extends Component {
el: 'EL_0'
};
constructor(props) {
super(props);
}
changeName = event => this.setState({ name: event.target.value });
changeGender = gender => this.setState({ gender });
changeEL = el => this.setState({ el });
@@ -1,17 +1,17 @@
import APStore from '../../../stores/APStore';
import BorderButton from '../../layout/BorderButton';
import CultureStore from '../../../stores/CultureStore';
import ELStore from '../../../stores/ELStore';
import HerolistActions from '../../../actions/HerolistActions';
import APStore from '../../stores/APStore';
import BorderButton from '../../components/BorderButton';
import CultureStore from '../../stores/CultureStore';
import ELStore from '../../stores/ELStore';
import HerolistActions from '../../actions/HerolistActions';
import HerolistItem from './HerolistItem';
import HerolistStore from '../../../stores/HerolistStore';
import ProfessionStore from '../../../stores/ProfessionStore';
import ProfileStore from '../../../stores/ProfileStore';
import RaceStore from '../../../stores/RaceStore';
import RadioButtonGroup from '../../layout/RadioButtonGroup';
import HerolistStore from '../../stores/HerolistStore';
import ProfessionStore from '../../stores/ProfessionStore';
import ProfileStore from '../../stores/ProfileStore';
import RaceStore from '../../stores/RaceStore';
import RadioButtonGroup from '../../components/RadioButtonGroup';
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
import TextField from '../../layout/TextField';
import Scroll from '../../components/Scroll';
import TextField from '../../components/TextField';
class Herolist extends Component {
@@ -20,10 +20,6 @@ class Herolist extends Component {
filter: HerolistStore.getFilter(),
sortOrder: HerolistStore.getSortOrder()
};
constructor(props) {
super(props);
}
_updateHerolistStore = () => this.setState({
list: HerolistStore.getAllForView(),
@@ -1,14 +1,14 @@
import Avatar from '../../layout/Avatar';
import BorderButton from '../../layout/BorderButton';
import CultureStore from '../../../stores/CultureStore';
import HerolistActions from '../../../actions/HerolistActions';
import ProfessionStore from '../../../stores/ProfessionStore';
import ProfessionVariantStore from '../../../stores/ProfessionVariantStore';
import ProfileStore from '../../../stores/ProfileStore';
import Avatar from '../../components/Avatar';
import BorderButton from '../../components/BorderButton';
import CultureStore from '../../stores/CultureStore';
import HerolistActions from '../../actions/HerolistActions';
import ProfessionStore from '../../stores/ProfessionStore';
import ProfessionVariantStore from '../../stores/ProfessionVariantStore';
import ProfileStore from '../../stores/ProfileStore';
import ProgressArc from 'react-progress-arc';
import RaceStore from '../../../stores/RaceStore';
import RaceStore from '../../stores/RaceStore';
import React, { PropTypes, Component } from 'react';
import TabActions from '../../../actions/TabActions';
import TabActions from '../../actions/TabActions';
import classNames from 'classnames';
class HerolistItem extends Component {
@@ -25,10 +25,6 @@ class HerolistItem extends Component {
pv: PropTypes.string
};
constructor(props) {
super(props);
}
load = () => HerolistActions.load(this.props.id);
show = () => TabActions.showSection('hero');
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import Scroll from '../../layout/Scroll';
import Scroll from '../../components/Scroll';
class Home extends Component {
render() {
@@ -1,12 +1,8 @@
import EquipmentActions from '../../../actions/EquipmentActions';
import EquipmentActions from '../../actions/EquipmentActions';
import React, { Component } from 'react';
class Equipment extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="page">
@@ -1,12 +1,8 @@
import InventoryActions from '../../../actions/InventoryActions';
import InventoryActions from '../../actions/InventoryActions';
import React, { Component } from 'react';
class Inventory extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="page">

Some files were not shown because too many files have changed in this diff Show More