Failed to commit these
This commit is contained in:
@@ -64,6 +64,17 @@ a {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.truncate {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.badwrap {
|
||||
overflow: wrap;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
/* footer */
|
||||
footer {
|
||||
flex: 0 1 auto;
|
||||
@@ -249,8 +260,8 @@ footer {
|
||||
}
|
||||
|
||||
.col {
|
||||
flex: 1;
|
||||
min-width: 80px;
|
||||
flex: 1 1 1%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.table.noCollapse .row {
|
||||
|
||||
+4
-4
@@ -147,16 +147,16 @@ const runCombatTick = (connection) => {
|
||||
|
||||
//determine the spoils and casualties
|
||||
let spoilsGold = Math.floor(results[0].gold * (victor === 'attacker' ? 0.1 : 0.02));
|
||||
let casualtiesVictor = Math.floor((pendingCombat.attackingUnits >= 10 ? pendingCombat.attackingUnits - 10 : 0) * (victor === 'attacker' ? 0.05 : 0.1));
|
||||
let attackerCasualties = Math.floor((pendingCombat.attackingUnits >= 10 ? pendingCombat.attackingUnits - 10 : 0) * (victor === 'attacker' ? 0.05 : 0.1));
|
||||
|
||||
//save the combat
|
||||
let query = 'INSERT INTO pastCombat (eventTime, attackerId, defenderId, attackingUnits, defendingUnits, undefended, victor, spoilsGold, casualtiesVictor) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);';
|
||||
connection.query(query, [pendingCombat.eventTime, pendingCombat.attackerId, pendingCombat.defenderId, pendingCombat.attackingUnits, defendingUnits, undefended, victor, spoilsGold, casualtiesVictor], (err) => {
|
||||
let query = 'INSERT INTO pastCombat (eventTime, attackerId, defenderId, attackingUnits, defendingUnits, undefended, victor, spoilsGold, attackerCasualties) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);';
|
||||
connection.query(query, [pendingCombat.eventTime, pendingCombat.attackerId, pendingCombat.defenderId, pendingCombat.attackingUnits, defendingUnits, undefended, victor, spoilsGold, attackerCasualties], (err) => {
|
||||
if (err) throw err;
|
||||
|
||||
//update the attacker profile
|
||||
let query = 'UPDATE profiles SET gold = gold + ?, soldiers = soldiers - ? WHERE accountId = ?;';
|
||||
connection.query(query, [spoilsGold, casualtiesVictor, pendingCombat.attackerId], (err) => {
|
||||
connection.query(query, [spoilsGold, attackerCasualties, pendingCombat.attackerId], (err) => {
|
||||
if (err) throw err;
|
||||
|
||||
//update the defender profile
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"Weapons": {
|
||||
"Stick": { "cost": 50, "combatBoost": 0.02, "scientistsRequired": 1, "purchasable": true },
|
||||
"Dagger": { "cost": 75, "combatBoost": 0.03, "scientistsRequired": 2, "purchasable": true },
|
||||
"Sword": { "cost": 100, "combatBoost": 0.04, "scientistsRequired": 3, "purchasable": true },
|
||||
"Longsword": { "cost": 150, "combatBoost": 0.05, "scientistsRequired": 4, "purchasable": true },
|
||||
"Frying Pan": { "cost": 200, "combatBoost": 0.06, "scientistsRequired": 5, "purchasable": true }
|
||||
"Stick": { "cost": 50, "purchasable": true, "saleable": true, "scientistsRequired": 1, "combatBoost": 0.02 },
|
||||
"Dagger": { "cost": 75, "purchasable": true, "saleable": true, "scientistsRequired": 2, "combatBoost": 0.03 },
|
||||
"Sword": { "cost": 100, "purchasable": true, "saleable": true, "scientistsRequired": 3, "combatBoost": 0.04 },
|
||||
"Longsword": { "cost": 150, "purchasable": true, "saleable": true, "scientistsRequired": 4, "combatBoost": 0.05 },
|
||||
"Frying Pan": { "cost": 200, "purchasable": true, "saleable": true, "scientistsRequired": 5, "combatBoost": 0.06 }
|
||||
},
|
||||
"Armour": {
|
||||
"Leather": { "cost": 75, "combatBoost": 0.02, "scientistsRequired": 2, "purchasable": true },
|
||||
"Gambeson": { "cost": 100, "combatBoost": 0.03, "scientistsRequired": 3, "purchasable": true },
|
||||
"Chainmail": { "cost": 150, "combatBoost": 0.04, "scientistsRequired": 4, "purchasable": true },
|
||||
"Platemail": { "cost": 200, "combatBoost": 0.05, "scientistsRequired": 5, "purchasable": true }
|
||||
"Leather": { "cost": 75, "purchasable": false, "saleable": true, "scientistsRequired": 2, "combatBoost": 0.02 },
|
||||
"Gambeson": { "cost": 100, "purchasable": false, "saleable": true, "scientistsRequired": 3, "combatBoost": 0.03 },
|
||||
"Chainmail": { "cost": 150, "purchasable": false, "saleable": true, "scientistsRequired": 4, "combatBoost": 0.04 },
|
||||
"Platemail": { "cost": 200, "purchasable": false, "saleable": true, "scientistsRequired": 5, "combatBoost": 0.05 }
|
||||
},
|
||||
"Consumables": {
|
||||
"Potion": { "cost": 100, "combatBoost": 0.04, "scientistsRequired": 1, "purchasable": true }
|
||||
"Potion": { "cost": 100, "purchasable": true, "saleable": true, "scientistsRequired": 1, "combatBoost": 0.04 }
|
||||
}
|
||||
}
|
||||
@@ -145,14 +145,14 @@ class Profile extends React.Component {
|
||||
<p className='col'>Gold:</p>
|
||||
<p className='col'>{this.props.profile.gold}</p>
|
||||
|
||||
<p className='col' style={{flex: '2 1 1%'}}>(+1 gold for each recruit every half hour)</p>
|
||||
<p className='col truncate' style={{flex: '2 1 2%'}}>(+1 gold for each recruit every half hour)</p>
|
||||
</div>
|
||||
|
||||
<div className='row'>
|
||||
<p className='col'>Recruits:</p>
|
||||
<p className='col'>{this.props.profile.recruits}</p>
|
||||
|
||||
<button className='col' style={{flex: '2 1 1%'}} onClick={ () => this.sendRequest('/recruitrequest') }>Recruit More Units</button>
|
||||
<button className='col' style={{flex: '2 1 2%'}} onClick={ () => this.sendRequest('/recruitrequest') }>Recruit More Units</button>
|
||||
</div>
|
||||
|
||||
<div className='row'>
|
||||
@@ -224,7 +224,7 @@ class Profile extends React.Component {
|
||||
|
||||
<AttackButton
|
||||
className='col'
|
||||
style={{flex: '2 1 1%'}}
|
||||
style={{flex: '2 1 2%'}}
|
||||
setWarning={this.setWarning.bind(this)}
|
||||
attacker={this.props.account.username}
|
||||
defender={this.props.profile.username}
|
||||
|
||||
@@ -33,21 +33,21 @@ class Equipment extends React.Component {
|
||||
<div className='panel'>
|
||||
<div className='table'>
|
||||
<div className='row'>
|
||||
<p className='col centered'>Name</p>
|
||||
<p className='col centered'>Type</p>
|
||||
<p className='col centered'>Owned</p>
|
||||
<p className='col centered'>Cost</p>
|
||||
<p className='col centered'>Buy</p>
|
||||
<p className='col centered'>Sell</p>
|
||||
<p className='col centered truncate'>Name</p>
|
||||
<p className='col centered truncate'>Type</p>
|
||||
<p className='col centered truncate'>Owned</p>
|
||||
<p className='col centered truncate'>Cost</p>
|
||||
<p className='col centered truncate'>Buy</p>
|
||||
<p className='col centered truncate'>Sell</p>
|
||||
</div>
|
||||
|
||||
{Object.keys(display).map((key) => <div className='row' key={key}>
|
||||
<p className='col centered'>{display[key].name}</p>
|
||||
<p className='col centered'>{display[key].type}</p>
|
||||
<p className='col centered'>{display[key].owned}</p>
|
||||
<p className='col centered'>{display[key].cost}</p>
|
||||
<button className='col centered' disabled={true || display[key].cost > this.props.gold}>+ Buy +</button>
|
||||
<button className='col centered' disabled={true || display[key].owned === 0}>- Sell -</button>
|
||||
<p className='col centered truncate'>{display[key].name}</p>
|
||||
<p className='col centered truncate'>{display[key].type}</p>
|
||||
<p className='col centered truncate'>{display[key].owned}</p>
|
||||
<p className='col centered truncate'>{display[key].cost}</p>
|
||||
{display[key].purchasable ? <button className='col centered truncate' disabled={true || display[key].cost > this.props.gold}>+ Buy +</button> : <div className='col centered truncate' />}
|
||||
{display[key].saleable ? <button className='col centered truncate' disabled={true || display[key].owned === 0}>- Sell -</button> : <div className='col centered truncate' />}
|
||||
</div>)}
|
||||
</div>
|
||||
</div>
|
||||
@@ -106,7 +106,7 @@ class Equipment extends React.Component {
|
||||
name: name,
|
||||
type: type,
|
||||
owned: (structure.owned && structure.owned[name]) || 0,
|
||||
cost: structure.statistics[type][name].cost
|
||||
...structure.statistics[type][name]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,27 +29,27 @@ class PagedCombatLog extends React.Component {
|
||||
return (
|
||||
<div className='table'>
|
||||
<div className='row'>
|
||||
<p className='col centered'>When</p>
|
||||
<p className='col centered'>Attacker</p>
|
||||
<p className='col centered'>Defender</p>
|
||||
<p className='col centered'>Attacking Force</p>
|
||||
<p className='col centered'>Defending Force</p>
|
||||
<p className='col centered'>Undefended?</p>
|
||||
<p className='col centered'>Victor</p>
|
||||
<p className='col centered'>Gold Transferred</p>
|
||||
<p className='col centered'>Victor Casualties</p>
|
||||
<p className='col centered badwrap'>When</p>
|
||||
<p className='col centered badwrap'>Attacker</p>
|
||||
<p className='col centered badwrap'>Defender</p>
|
||||
<p className='col centered badwrap'>Attacking Force</p>
|
||||
<p className='col centered badwrap'>Defending Force</p>
|
||||
<p className='col centered badwrap'>Undefended?</p>
|
||||
<p className='col centered badwrap'>Victor</p>
|
||||
<p className='col centered badwrap'>Gold Stolen</p>
|
||||
<p className='col centered badwrap'>Attacker Deaths</p>
|
||||
</div>
|
||||
|
||||
{Object.keys(this.state).map((key) => <div key={key} className={'row'}>
|
||||
<p className='col centered'>{ this.parseDate(this.state[key].eventTime) }</p>
|
||||
<PrettyName className='col centered' name={this.state[key].attacker} />
|
||||
<PrettyName className='col centered' name={this.state[key].defender} />
|
||||
<p className='col centered'>{this.state[key].attackingUnits}</p>
|
||||
<p className='col centered'>{this.state[key].defendingUnits}</p>
|
||||
<p className='col centered'>{this.state[key].undefended ? 'yes' : 'no'}</p>
|
||||
<p className='col centered'>{this.state[key].victor}</p>
|
||||
<p className='col centered'>{this.state[key].spoilsGold}</p>
|
||||
<p className='col centered'>{this.state[key].casualtiesVictor}</p>
|
||||
<p className='col centered truncate'>{ this.parseDate(this.state[key].eventTime) }</p>
|
||||
<PrettyName className='col centered truncate' name={this.state[key].attacker} />
|
||||
<PrettyName className='col centered truncate' name={this.state[key].defender} />
|
||||
<p className='col centered truncate'>{this.state[key].attackingUnits}</p>
|
||||
<p className='col centered truncate'>{this.state[key].defendingUnits}</p>
|
||||
<p className='col centered truncate'>{this.state[key].undefended ? 'yes' : 'no'}</p>
|
||||
<p className='col centered truncate'>{this.state[key].victor}</p>
|
||||
<p className='col centered truncate'>{this.state[key].spoilsGold}</p>
|
||||
<p className='col centered truncate'>{this.state[key].attackerCasualties}</p>
|
||||
</div>)}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -24,10 +24,10 @@ class PagedLadder extends React.Component {
|
||||
<p className='col centered'>Gold</p>
|
||||
</div>
|
||||
{Object.keys(this.state).map((key) => <div key={key} className={'row'}>
|
||||
<p className={'col centered'}><Link to={`/profile?username=${this.state[key].username}`}>{this.state[key].username}</Link></p>
|
||||
<p className={'col centered'}>{this.state[key].soldiers}</p>
|
||||
<p className={'col centered'}>{this.state[key].recruits}</p>
|
||||
<p className={'col centered'}>{this.state[key].gold}</p>
|
||||
<p className={'col centered truncate'}><Link to={`/profile?username=${this.state[key].username}`}>{this.state[key].username}</Link></p>
|
||||
<p className={'col centered truncate'}>{this.state[key].soldiers}</p>
|
||||
<p className={'col centered truncate'}>{this.state[key].recruits}</p>
|
||||
<p className={'col centered truncate'}>{this.state[key].gold}</p>
|
||||
</div> )}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user