Added sex differences in profession names
This commit is contained in:
Vendored
+2
-2
File diff suppressed because one or more lines are too long
Vendored
+353
-258
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,8 @@ var _heroes = {
|
||||
r: 'R_5',
|
||||
c: 'C_7',
|
||||
p: 'P_24',
|
||||
pv: null
|
||||
pv: null,
|
||||
sex: 'm'
|
||||
},
|
||||
'H_2': {
|
||||
id: 'H_2',
|
||||
@@ -34,7 +35,8 @@ var _heroes = {
|
||||
r: 'R_1',
|
||||
c: 'C_8',
|
||||
p: 'P_23',
|
||||
pv: null
|
||||
pv: null,
|
||||
sex: 'm'
|
||||
},
|
||||
'H_3': {
|
||||
id: 'H_3',
|
||||
@@ -46,7 +48,8 @@ var _heroes = {
|
||||
r: 'R_4',
|
||||
c: 'C_17',
|
||||
p: 'P_23',
|
||||
pv: null
|
||||
pv: null,
|
||||
sex: 'm'
|
||||
},
|
||||
'H_4': {
|
||||
id: 'H_4',
|
||||
@@ -58,7 +61,8 @@ var _heroes = {
|
||||
r: 'R_1',
|
||||
c: 'C_15',
|
||||
p: 'P_22',
|
||||
pv: null
|
||||
pv: null,
|
||||
sex: 'm'
|
||||
},
|
||||
'H_5': {
|
||||
id: 'H_5',
|
||||
@@ -70,7 +74,8 @@ var _heroes = {
|
||||
r: 'R_1',
|
||||
c: 'C_8',
|
||||
p: 'P_26',
|
||||
pv: null
|
||||
pv: null,
|
||||
sex: 'm'
|
||||
},
|
||||
'H_6': {
|
||||
id: 'H_6',
|
||||
@@ -82,7 +87,8 @@ var _heroes = {
|
||||
r: 'R_5',
|
||||
c: 'C_14',
|
||||
p: 'P_4',
|
||||
pv: 'PV_13'
|
||||
pv: 'PV_13',
|
||||
sex: 'm'
|
||||
},
|
||||
'H_7': {
|
||||
id: 'H_7',
|
||||
@@ -94,7 +100,8 @@ var _heroes = {
|
||||
r: 'R_1',
|
||||
c: 'C_1',
|
||||
p: 'P_16',
|
||||
pv: null
|
||||
pv: null,
|
||||
sex: 'm'
|
||||
},
|
||||
'H_8': {
|
||||
id: 'H_8',
|
||||
@@ -106,7 +113,8 @@ var _heroes = {
|
||||
r: 'R_6',
|
||||
c: 'C_9',
|
||||
p: 'P_4',
|
||||
pv: null
|
||||
pv: null,
|
||||
sex: 'm'
|
||||
},
|
||||
'H_9': {
|
||||
player: ['U_5', 'Maradas'],
|
||||
@@ -119,7 +127,8 @@ var _heroes = {
|
||||
r: 'R_1',
|
||||
c: 'C_15',
|
||||
p: 'P_24',
|
||||
pv: null
|
||||
pv: null,
|
||||
sex: 'm'
|
||||
}
|
||||
};
|
||||
var _filter = 'Shimo';
|
||||
|
||||
+41
-7
@@ -6,7 +6,20 @@ export const filter = (list, filterText) => {
|
||||
return list;
|
||||
};
|
||||
|
||||
export const sortByName = list => {
|
||||
export const sortByName = (list, sex) => {
|
||||
if (sex) {
|
||||
return list.sort((a,b) => {
|
||||
let an = a.name[sex] || a.name;
|
||||
let bn = b.name[sex] || b.name;
|
||||
if (an < bn) {
|
||||
return -1;
|
||||
} else if (an > bn) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
return list.sort((a,b) => {
|
||||
if (a.name < b.name) {
|
||||
return -1;
|
||||
@@ -36,7 +49,26 @@ export const sortByGroup = list => {
|
||||
});
|
||||
};
|
||||
|
||||
export const sortByAP = list => {
|
||||
export const sortByCost = (list, sex) => {
|
||||
if (sex) {
|
||||
return list.sort((a, b) => {
|
||||
let an = a.name[sex] || a.name;
|
||||
let bn = b.name[sex] || b.name;
|
||||
if (a.ap < b.ap) {
|
||||
return -1;
|
||||
} else if (a.ap > b.ap) {
|
||||
return 1;
|
||||
} else {
|
||||
if (an < bn) {
|
||||
return -1;
|
||||
} else if (an > bn) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return list.sort((a, b) => {
|
||||
if (a.ap < b.ap) {
|
||||
return -1;
|
||||
@@ -54,18 +86,20 @@ export const sortByAP = list => {
|
||||
});
|
||||
};
|
||||
|
||||
export const sort = (list, sortOrder) => {
|
||||
export const sort = (list, sortOrder, sex) => {
|
||||
switch (sortOrder) {
|
||||
case 'name':
|
||||
return sortByName(list);
|
||||
return sortByName(list, sex);
|
||||
case 'group':
|
||||
return sortByGroup(list);
|
||||
return sortByGroup(list, sex);
|
||||
case 'cost':
|
||||
return sortByCost(list, sex);
|
||||
|
||||
default:
|
||||
return list;
|
||||
}
|
||||
};
|
||||
|
||||
export const filterAndSort = (list, filterText, sortOrder) => {
|
||||
return sort(filter(list, filterText), sortOrder);
|
||||
export const filterAndSort = (list, filterText, sortOrder, sex) => {
|
||||
return sort(filter(list, filterText), sortOrder, sex);
|
||||
};
|
||||
|
||||
@@ -134,7 +134,6 @@ var WebAPIUtils = {
|
||||
loadHero: function(id) {
|
||||
ServerActions.startLoading();
|
||||
ServerActions.loadHeroSuccess(id, `{
|
||||
"sex":"m",
|
||||
"pers":{
|
||||
"family": "ibn Rashtul",
|
||||
"placeofbirth": "Rashdul",
|
||||
|
||||
@@ -30,10 +30,10 @@ export const generateArray = () => [
|
||||
r: RaceStore.getCurrentID(),
|
||||
c: CultureStore.getCurrentID(),
|
||||
p: ProfessionStore.getCurrentID(),
|
||||
pv: ProfessionVariantStore.getCurrentID()
|
||||
pv: ProfessionVariantStore.getCurrentID(),
|
||||
sex: ProfileStore.getSex()
|
||||
},
|
||||
{
|
||||
sex: ProfileStore.getSex(),
|
||||
pers: ProfileStore.getAppearance(),
|
||||
attr: AttributeStore.getForSave(),
|
||||
disadv: DisAdvStore.getForSave(),
|
||||
|
||||
@@ -24,7 +24,8 @@ export default class HerolistItem extends Component {
|
||||
p: PropTypes.string,
|
||||
player: PropTypes.array,
|
||||
pv: PropTypes.string,
|
||||
r: PropTypes.string
|
||||
r: PropTypes.string,
|
||||
sex: PropTypes.string
|
||||
};
|
||||
|
||||
load = () => HerolistActions.load(this.props.id);
|
||||
@@ -32,7 +33,7 @@ export default class HerolistItem extends Component {
|
||||
|
||||
render() {
|
||||
|
||||
const { player, id, name, avatar, ap: { total: apTotal }, r, c, p, pv } = this.props;
|
||||
const { player, id, name, avatar, ap: { total: apTotal }, r, c, p, pv, sex } = this.props;
|
||||
|
||||
const elRoman = [ 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII' ];
|
||||
const elAp = [ 900, 1000, 1100, 1200, 1400, 1700, 2100 ];
|
||||
@@ -71,8 +72,17 @@ export default class HerolistItem extends Component {
|
||||
</span>
|
||||
<span className="profession">
|
||||
{(() => {
|
||||
const { name, subname } = ProfessionStore.get(p) || { name: 'Loading...' };
|
||||
const { name: vname } = ProfessionVariantStore.get(pv) || { name: 'Loading...' };
|
||||
let { name, subname } = ProfessionStore.get(p) || { name: 'Loading...' };
|
||||
if (typeof name === 'object') {
|
||||
name = name[sex];
|
||||
}
|
||||
if (typeof subname === 'object') {
|
||||
subname = subname[sex];
|
||||
}
|
||||
let { name: vname } = ProfessionVariantStore.get(pv) || { name: 'Loading...' };
|
||||
if (typeof vname === 'object') {
|
||||
vname = vname[sex];
|
||||
}
|
||||
return name + (subname ? ` (${subname})` : pv ? ` (${vname})` : '');
|
||||
})()}
|
||||
</span>
|
||||
|
||||
@@ -103,8 +103,21 @@ export default class Overview extends Component {
|
||||
</span>
|
||||
<span className="profession">
|
||||
{(() => {
|
||||
const { name, subname } = ProfessionStore.getCurrent();
|
||||
const { name: vname } = ProfessionVariantStore.getCurrent() || {};
|
||||
let { name, subname } = ProfessionStore.getCurrent();
|
||||
|
||||
if (typeof name === 'object') {
|
||||
name = name[this.state.sex];
|
||||
}
|
||||
if (typeof subname === 'object') {
|
||||
subname = subname[this.state.sex];
|
||||
}
|
||||
|
||||
let { name: vname } = ProfessionVariantStore.getCurrent() || {};
|
||||
|
||||
if (typeof vname === 'object') {
|
||||
vname = vname[this.state.sex];
|
||||
}
|
||||
|
||||
return name + (subname ? ` (${subname})` : vname ? ` (${vname})` : '');
|
||||
})()}
|
||||
</span>
|
||||
|
||||
@@ -65,7 +65,7 @@ export default class Cultures extends Component {
|
||||
onClick={this.sort}
|
||||
array={[
|
||||
{ name: 'Alphabetisch', value: 'name' },
|
||||
{ name: 'AP', value: 'ap' }
|
||||
{ name: 'Kosten', value: 'cost' }
|
||||
]}
|
||||
/>
|
||||
<Checkbox checked={showDetails} onClick={this.changeValueVisibility}>Werte anzeigen</Checkbox>
|
||||
|
||||
@@ -8,6 +8,7 @@ import ProfessionsListItem from './ProfessionsListItem';
|
||||
import ProfessionStore from '../../stores/ProfessionStore';
|
||||
import ProfessionVariantActions from '../../actions/ProfessionVariantActions';
|
||||
import ProfessionVariantStore from '../../stores/ProfessionVariantStore';
|
||||
import ProfileStore from '../../stores/ProfileStore';
|
||||
import Scroll from '../../components/Scroll';
|
||||
import Selections from './Selections';
|
||||
import TextField from '../../components/TextField';
|
||||
@@ -63,7 +64,9 @@ export default class Professions extends Component {
|
||||
|
||||
const currentCulture = CultureStore.getCurrent();
|
||||
|
||||
const list = filterAndSort(professions.filter(e => showAllProfessions || currentCulture.typ_prof.includes(e.id) || e.id === 'P_0'), filterText, sortOrder);
|
||||
const sex = ProfileStore.getSex();
|
||||
|
||||
const list = filterAndSort(professions.filter(e => showAllProfessions || currentCulture.typ_prof.includes(e.id) || e.id === 'P_0'), filterText, sortOrder, sex);
|
||||
|
||||
return (
|
||||
<div className="page" id="professions">
|
||||
@@ -83,8 +86,8 @@ export default class Professions extends Component {
|
||||
value: 'name'
|
||||
},
|
||||
{
|
||||
name: 'AP',
|
||||
value: 'ap'
|
||||
name: 'Kosten',
|
||||
value: 'cost'
|
||||
}
|
||||
]} />
|
||||
</div>
|
||||
@@ -97,6 +100,7 @@ export default class Professions extends Component {
|
||||
currentID={currentID}
|
||||
currentVID={currentVID}
|
||||
profession={profession}
|
||||
sex={sex}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ export default class ProfessionsListItem extends Component {
|
||||
currentID: PropTypes.string,
|
||||
currentVID: PropTypes.string,
|
||||
profession: PropTypes.instanceOf(Profession).isRequired,
|
||||
sex: PropTypes.string.isRequired,
|
||||
showAddSlidein: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
@@ -23,7 +24,7 @@ export default class ProfessionsListItem extends Component {
|
||||
|
||||
render() {
|
||||
|
||||
const { showAddSlidein, currentID, currentVID, profession } = this.props;
|
||||
const { showAddSlidein, currentID, currentVID, profession, sex } = this.props;
|
||||
|
||||
const className = classNames({
|
||||
'active': profession.id === currentID
|
||||
@@ -34,13 +35,13 @@ export default class ProfessionsListItem extends Component {
|
||||
var allVariants = ProfessionVariantStore.getAll().filter(e => {
|
||||
if (profession.variants.includes(e.id)) {
|
||||
if (e.reqs_p !== null) {
|
||||
return e.reqs_p.some(req => {
|
||||
return e.reqs_p.every(req => {
|
||||
if (req[0] === 'c') {
|
||||
let cultureID = CultureStore.getCurrentID();
|
||||
return !req[1].includes(cultureID);
|
||||
return req[1].includes(cultureID);
|
||||
} else if (req[0] === 'g') {
|
||||
let gender = ProfileStore.getGender();
|
||||
return gender !== req[1];
|
||||
return gender === req[1];
|
||||
}
|
||||
return false;
|
||||
});
|
||||
@@ -49,11 +50,17 @@ export default class ProfessionsListItem extends Component {
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (allVariants.length > 1) {
|
||||
allVariants = allVariants.map(e => ({
|
||||
name: `${e.name} (${profession.ap + e.ap} AP)`,
|
||||
value: e.id
|
||||
}));
|
||||
if (allVariants.length > 0) {
|
||||
allVariants = allVariants.map(e => {
|
||||
let { ap, id, name } = e;
|
||||
if (typeof name === 'object') {
|
||||
name = name[sex];
|
||||
}
|
||||
return {
|
||||
name: `${name} (${profession.ap + ap} AP)`,
|
||||
value: id
|
||||
};
|
||||
});
|
||||
allVariants.splice(0, 0, {
|
||||
name: 'Keine Variante',
|
||||
value: null
|
||||
@@ -64,11 +71,20 @@ export default class ProfessionsListItem extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
let { name, subname } = profession;
|
||||
|
||||
if (typeof name === 'object') {
|
||||
name = name[sex];
|
||||
}
|
||||
if (typeof subname === 'object') {
|
||||
subname = subname[sex];
|
||||
}
|
||||
|
||||
return (
|
||||
<li className={className}>
|
||||
<div className="left">
|
||||
<h2>{profession.name} ({profession.ap} AP)</h2>
|
||||
{profession.subname !== '' ? <h3>{profession.subname}</h3> : null}
|
||||
<h2>{name} ({profession.ap} AP)</h2>
|
||||
{subname ? <h3>{subname}</h3> : null}
|
||||
{variants}
|
||||
</div>
|
||||
<div className="right">
|
||||
|
||||
@@ -53,7 +53,7 @@ export default class Races extends Component {
|
||||
onClick={this.sort}
|
||||
array={[
|
||||
{ name: 'Alphabetisch', value: 'name' },
|
||||
{ name: 'AP', value: 'ap' }
|
||||
{ name: 'Kosten', value: 'cost' }
|
||||
]}
|
||||
/>
|
||||
<Checkbox checked={showDetails} onClick={this.changeValueVisibility}>Werte anzeigen</Checkbox>
|
||||
|
||||
Reference in New Issue
Block a user