+import { withFormik } from 'formik';
+import PropTypes from 'prop-types';
+import React from 'react';
+import { Button, Col, Container, Form, Row } from 'react-bootstrap';
+import { withTranslation } from 'react-i18next';
+
+import i18n from '../../i18n';
+
+const settings = [
+ 'logic',
+ 'nodupes',
+ 'panther',
+ 'area',
+ 'boss',
+ 'enemy',
+ 'itempool',
+ 'weight',
+ 'grahm',
+ 'kicker',
+ 'startshop',
+ 'shopprice',
+ 'shopSouls',
+ 'levelexp',
+ 'telestart',
+ 'mapassist',
+ 'doublechaos',
+ 'reqallsouls',
+ 'noww',
+ 'palette',
+];
+
+const settingValues = {
+ area: [
+ 'AreaRandom',
+ 'DoorRandom',
+ 'Vanilla',
+ ],
+ boss: [
+ 'Dead-endShuffle',
+ 'Vanilla',
+ ],
+ doublechaos: [
+ 'false',
+ 'true',
+ ],
+ enemy: [
+ 'RandomNoLimit',
+ 'RandomP20M5',
+ 'RandomP30M10',
+ 'RandomPM10',
+ 'RandomPM20',
+ 'RandomPMaxM5',
+ 'Vanilla',
+ ],
+ grahm: [
+ 'AllBosses',
+ 'BookSouls',
+ 'NoCheck',
+ ],
+ itempool: [
+ 'AllSouls',
+ 'Standard',
+ ],
+ kicker: [
+ 'false',
+ 'true',
+ ],
+ levelexp: [
+ 'Casual',
+ 'Hard',
+ 'Lvl1',
+ 'Vanilla',
+ ],
+ logic: [
+ 'AreaTechTiers',
+ 'AreaTechTiersHard',
+ 'ForwardFeed',
+ 'ForwardFeedHard',
+ 'HybridProgression',
+ 'VeryRandom',
+ 'VeryRandomHard',
+ 'VeryRandomHardOnly',
+ ],
+ mapassist: [
+ 'false',
+ 'true',
+ ],
+ nodupes: [
+ 'false',
+ 'true',
+ ],
+ noww: [
+ 'false',
+ 'true',
+ ],
+ palette: [
+ 'Mode1',
+ 'Mode1.5',
+ 'Mode2',
+ 'Vanilla',
+ ],
+ panther: [
+ 'AlwaysRand',
+ 'ExtraFairRand',
+ 'FirstAlways',
+ 'NeverExists',
+ 'Rand70Dup',
+ ],
+ reqallsouls: [
+ 'false',
+ 'true',
+ ],
+ shopprice: [
+ 'RandHV',
+ 'Vanilla',
+ ],
+ shopSouls: [
+ '2PerGroup',
+ 'Half',
+ 'OnlySouls',
+ 'Vanilla',
+ ],
+ startshop: [
+ 'Unlocked',
+ 'Unlocked30k',
+ 'Vanilla',
+ ],
+ telestart: [
+ 'false',
+ 'true',
+ ],
+ weight: [
+ '0',
+ '1.0',
+ '1.5',
+ '2.0',
+ '2.5',
+ '3.0',
+ '3.5',
+ ],
+};
+
+const Generate = ({
+ handleBlur,
+ handleChange,
+ handleSubmit,
+ presets,
+ setFieldValue,
+ values,
+}) =>
+<Container>
+ <h1>{i18n.t('aosGenerate.heading')}</h1>
+ <Form noValidate onSubmit={handleSubmit}>
+ <Row>
+ <Col md={6}>
+ <Form.Group controlId="generate.preset">
+ <Form.Label>
+ {i18n.t('aosSeeds.preset')}
+ </Form.Label>
+ <Form.Select
+ name="preset"
+ onBlur={handleBlur}
+ onChange={e => {
+ const presetName = e.target.value;
+ const preset = presets.find(p => p.value === presetName);
+ if (preset) {
+ setFieldValue('settings', preset.settings);
+ }
+ return handleChange(e);
+ }}
+ value={values.preset}
+ >
+ <option value="custom">{i18n.t('aosSeeds.presets.custom')}</option>
+ {presets.map(preset =>
+ <option key={preset.value} value={preset.value}>
+ {i18n.t(`aosSeeds.presets.${preset.value}`)}
+ </option>
+ )}
+ </Form.Select>
+ </Form.Group>
+ </Col>
+ <Col sm={6} md={3}>
+ <Form.Group controlId="generate.submit">
+ <Form.Label>
+ {i18n.t('button.generate')}
+ </Form.Label>
+ <div>
+ <Button type="submit">
+ {i18n.t('button.generate')}
+ </Button>
+ </div>
+ </Form.Group>
+ </Col>
+ </Row>
+ <Row>
+ {settings.map(setting =>
+ <Form.Group as={Col} md={4} key={setting} controlId={`generate.${setting}`}>
+ <Form.Label>
+ {i18n.t(`aosSeeds.settingName.${setting}`)}
+ </Form.Label>
+ <Form.Select
+ name={`settings[${setting}]`}
+ onBlur={handleBlur}
+ onChange={e => {
+ setFieldValue('preset', 'custom');
+ return handleChange(e);
+ }}
+ value={values.settings[setting]}
+ >
+ {settingValues[setting].map(value =>
+ <option key={value} value={value}>
+ {i18n.t(`aosSeeds.settingValue.${setting}.${value}`)}
+ </option>
+ )}
+ </Form.Select>
+ </Form.Group>
+ )}
+ </Row>
+ </Form>
+</Container>;
+
+Generate.propTypes = {
+ handleBlur: PropTypes.func,
+ handleChange: PropTypes.func,
+ handleSubmit: PropTypes.func,
+ presets: PropTypes.arrayOf(PropTypes.shape({
+ settings: PropTypes.shape({
+ }),
+ value: PropTypes.string,
+ })),
+ setFieldValue: PropTypes.func,
+ values: PropTypes.shape({
+ preset: PropTypes.string,
+ settings: PropTypes.shape({
+ }),
+ }),
+};
+
+export default withFormik({
+ displayName: 'AosGenerateForm',
+ mapPropsToValues: () => ({
+ preset: 'Normal',
+ settings: {
+ area: 'Vanilla',
+ boss: 'Vanilla',
+ doublechaos: 'false',
+ enemy: 'Vanilla',
+ grahm: 'BookSouls',
+ itempool: 'Standard',
+ kicker: 'false',
+ levelexp: 'Vanilla',
+ logic: 'AreaTechTiers',
+ mapassist: 'false',
+ nodupes: 'false',
+ noww: 'false',
+ palette: 'Vanilla',
+ panther: 'Rand70Dup',
+ reqallsouls: 'false',
+ shopprice: 'Vanilla',
+ shopSouls: 'Vanilla',
+ startshop: 'Vanilla',
+ telestart: 'false',
+ weight: '2.5',
+ },
+ }),
+})(withTranslation()(Generate));