|
|
|
@ -31,7 +31,7 @@ import { connect } from 'react-redux'
|
|
|
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
|
|
|
import { faUser, faUsers, faTractor, faWindowRestore,
|
|
|
|
|
faDollarSign, faTimes, faAsterisk, faExchangeAlt,
|
|
|
|
|
faInfoCircle } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
faInfoCircle, faArrowUp } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
|
|
import { GroupBox, Row, Col, Button } from '../widgets.jsx'
|
|
|
|
|
import SpaceNode from './SpaceNode.jsx'
|
|
|
|
@ -180,6 +180,9 @@ class ResourceUnit extends React.Component {
|
|
|
|
|
borderTop: '3px solid ' + hslString + '%, 55%)'}}>
|
|
|
|
|
{this.props.img ? (<img src={this.props.img} />) : (<Fragment />)}
|
|
|
|
|
{this.props.children}
|
|
|
|
|
{this.props.doubled ? (
|
|
|
|
|
<p>x2!</p>
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -189,7 +192,7 @@ class PlayerTradeResources extends React.Component {
|
|
|
|
|
render () {
|
|
|
|
|
let player = this.props.player;
|
|
|
|
|
return (<form onSubmit={e => tradeFormSubmit(e, player)}>
|
|
|
|
|
<div className='player-trade-resources'>
|
|
|
|
|
<div className='player-trade-resources'>
|
|
|
|
|
<ResourceUnit h='120' s='100' label='acres of Hay' amount={''}>
|
|
|
|
|
<input type='number' id='trade-hay' defaultValue='0' /></ResourceUnit> {' '}
|
|
|
|
|
<ResourceUnit h='41' s='100' label='acres of Grain' amount={''}>
|
|
|
|
@ -228,8 +231,8 @@ class PlayerTradeResources extends React.Component {
|
|
|
|
|
</Row>
|
|
|
|
|
<PlayerTradeProposed player={this.props.player} />
|
|
|
|
|
<PlayerTradeButton player={this.props.player} />
|
|
|
|
|
</div>
|
|
|
|
|
</form>);
|
|
|
|
|
</div>
|
|
|
|
|
</form>);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -239,11 +242,15 @@ class PlayerResources extends React.Component {
|
|
|
|
|
return (
|
|
|
|
|
<div className='resource-unit-container'>
|
|
|
|
|
<ResourceUnit img={HayImg} h='120' s='100' label='acres of Hay'
|
|
|
|
|
amount={player.assets.hay}>
|
|
|
|
|
amount={player.assets.hay}
|
|
|
|
|
doubled={player.hayDoubled}
|
|
|
|
|
>
|
|
|
|
|
{player.assets.hay}
|
|
|
|
|
</ResourceUnit> {' '}
|
|
|
|
|
<ResourceUnit img={WheatImg} h='41' s='100' label='acres of Grain'
|
|
|
|
|
amount={player.assets.grain}>
|
|
|
|
|
amount={player.assets.grain}
|
|
|
|
|
doubled={player.cornDoubled}
|
|
|
|
|
>
|
|
|
|
|
{player.assets.grain}
|
|
|
|
|
</ResourceUnit> {' '}
|
|
|
|
|
<ResourceUnit img={FruitImg} h='0' s='100' label='acres of Fruit'
|
|
|
|
@ -555,6 +562,21 @@ class Loans extends React.Component {
|
|
|
|
|
loan(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maxRepay = e => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
this.setState({ repay: Math.max(0, Math.floor(
|
|
|
|
|
Math.min(this.props.player.debt + 900, this.props.player.displayCash) / 1000)) });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maxTakeout = e => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
this.setState({ takeOut: Math.max(0, Math.floor(this.state.maxLoan / 1000)) });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
quickLoan = i => {
|
|
|
|
|
loan(i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
|
if (this.props.player.debt !== prevProps.player.debt ||
|
|
|
|
|
this.props.game.settings.loanInterest !== prevProps.game.settings.loanInterest ||
|
|
|
|
@ -578,7 +600,12 @@ class Loans extends React.Component {
|
|
|
|
|
<br />
|
|
|
|
|
<form onSubmit={this.handleSubmit}>
|
|
|
|
|
<Row collapse='true'>
|
|
|
|
|
<Col width='8'>
|
|
|
|
|
<Col width="2">
|
|
|
|
|
{this.props.player.displayCash >= 1000 ? (
|
|
|
|
|
<Button className="tiny" onClick={() => this.quickLoan(-1)}>-1</Button>
|
|
|
|
|
) : (<span>{' '}</span>)}
|
|
|
|
|
</Col>
|
|
|
|
|
<Col width='6'>
|
|
|
|
|
<div className='money'>
|
|
|
|
|
$:
|
|
|
|
|
<input onChange={this.handleInput} name='repay' type='number'
|
|
|
|
@ -587,11 +614,17 @@ class Loans extends React.Component {
|
|
|
|
|
</div>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col width='4'>
|
|
|
|
|
<Button className='tiny' onClick={this.maxRepay}><FontAwesomeIcon icon={faArrowUp} /></Button>{' '}
|
|
|
|
|
<Button className='tiny' type='submit'>Repay</Button>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row collapse='true'>
|
|
|
|
|
<Col width='8'>
|
|
|
|
|
<Col width="2">
|
|
|
|
|
{this.props.player.debt < this.props.game.settings.maxDebt ? (
|
|
|
|
|
<Button className="tiny" onClick={() => this.quickLoan(1)}>+1</Button>
|
|
|
|
|
) : (<span>{' ' }</span>)}
|
|
|
|
|
</Col>
|
|
|
|
|
<Col width='6'>
|
|
|
|
|
<div className='money'>
|
|
|
|
|
$:
|
|
|
|
|
<input onChange={this.handleInput} name='takeOut' type='number'
|
|
|
|
@ -600,6 +633,7 @@ class Loans extends React.Component {
|
|
|
|
|
</div>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col width='4'>
|
|
|
|
|
<Button className='tiny' onClick={this.maxTakeout}><FontAwesomeIcon icon={faArrowUp} /></Button>{' '}
|
|
|
|
|
<Button className='tiny' type='submit'>Take Out</Button>
|
|
|
|
|
</Col>
|
|
|
|
|
</Row>
|
|
|
|
@ -875,6 +909,9 @@ class Harvest extends React.Component {
|
|
|
|
|
Roll for harvest!
|
|
|
|
|
</Button>
|
|
|
|
|
) : (<Fragment />)}
|
|
|
|
|
{this.props.harvestMult !== 1 ? (
|
|
|
|
|
<span>Multiplied by {this.props.harvestMult}!</span>
|
|
|
|
|
) : (<></>)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
@ -1170,6 +1207,8 @@ class Action extends React.Component {
|
|
|
|
|
case 'harvest':
|
|
|
|
|
view = (<Harvest rolled={this.props.ui.actionValue.rolled}
|
|
|
|
|
player={this.props.player}
|
|
|
|
|
currentPlayer={currentPlayer}
|
|
|
|
|
harvestMult={this.props.ui.actionValue.harvestMult}
|
|
|
|
|
game={this.props.game}
|
|
|
|
|
income={this.props.ui.actionValue.income}
|
|
|
|
|
contents={this.props.ui.actionValue.operatingExpense}
|
|
|
|
@ -1764,6 +1803,7 @@ class Card extends React.Component {
|
|
|
|
|
handleSubmit = e => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
buy(this.props.card.id, this.state.cash);
|
|
|
|
|
this.setState({ cash: 0 });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
|