From bdba64aed31709a65358be42b7ce06ff44c349db Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Sat, 1 Jun 2019 16:48:08 +1000 Subject: [PATCH] Failed to commit these --- public/styles/shared.css | 15 +++++++-- server/combat.js | 8 ++--- server/equipment_statistics.json | 20 ++++++------ src/components/pages/profile.jsx | 6 ++-- src/components/panels/equipment.jsx | 26 ++++++++-------- src/components/panels/paged_combat_log.jsx | 36 +++++++++++----------- src/components/panels/paged_ladder.jsx | 8 ++--- 7 files changed, 65 insertions(+), 54 deletions(-) diff --git a/public/styles/shared.css b/public/styles/shared.css index 62db646..089a92d 100644 --- a/public/styles/shared.css +++ b/public/styles/shared.css @@ -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 { diff --git a/server/combat.js b/server/combat.js index d59c506..8f6bb1d 100644 --- a/server/combat.js +++ b/server/combat.js @@ -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 diff --git a/server/equipment_statistics.json b/server/equipment_statistics.json index 7c2c0b0..0c9cd43 100644 --- a/server/equipment_statistics.json +++ b/server/equipment_statistics.json @@ -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 } } } \ No newline at end of file diff --git a/src/components/pages/profile.jsx b/src/components/pages/profile.jsx index 2b743e5..683d371 100644 --- a/src/components/pages/profile.jsx +++ b/src/components/pages/profile.jsx @@ -145,14 +145,14 @@ class Profile extends React.Component {

Gold:

{this.props.profile.gold}

-

(+1 gold for each recruit every half hour)

+

(+1 gold for each recruit every half hour)

Recruits:

{this.props.profile.recruits}

- +
@@ -224,7 +224,7 @@ class Profile extends React.Component {
-

Name

-

Type

-

Owned

-

Cost

-

Buy

-

Sell

+

Name

+

Type

+

Owned

+

Cost

+

Buy

+

Sell

{Object.keys(display).map((key) =>
-

{display[key].name}

-

{display[key].type}

-

{display[key].owned}

-

{display[key].cost}

- - +

{display[key].name}

+

{display[key].type}

+

{display[key].owned}

+

{display[key].cost}

+ {display[key].purchasable ? :
} + {display[key].saleable ? :
}
)}
@@ -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] }); }); }); diff --git a/src/components/panels/paged_combat_log.jsx b/src/components/panels/paged_combat_log.jsx index 30ba00d..fdfcdf9 100644 --- a/src/components/panels/paged_combat_log.jsx +++ b/src/components/panels/paged_combat_log.jsx @@ -29,27 +29,27 @@ class PagedCombatLog extends React.Component { return (
-

When

-

Attacker

-

Defender

-

Attacking Force

-

Defending Force

-

Undefended?

-

Victor

-

Gold Transferred

-

Victor Casualties

+

When

+

Attacker

+

Defender

+

Attacking Force

+

Defending Force

+

Undefended?

+

Victor

+

Gold Stolen

+

Attacker Deaths

{Object.keys(this.state).map((key) =>
-

{ this.parseDate(this.state[key].eventTime) }

- - -

{this.state[key].attackingUnits}

-

{this.state[key].defendingUnits}

-

{this.state[key].undefended ? 'yes' : 'no'}

-

{this.state[key].victor}

-

{this.state[key].spoilsGold}

-

{this.state[key].casualtiesVictor}

+

{ this.parseDate(this.state[key].eventTime) }

+ + +

{this.state[key].attackingUnits}

+

{this.state[key].defendingUnits}

+

{this.state[key].undefended ? 'yes' : 'no'}

+

{this.state[key].victor}

+

{this.state[key].spoilsGold}

+

{this.state[key].attackerCasualties}

)}
); diff --git a/src/components/panels/paged_ladder.jsx b/src/components/panels/paged_ladder.jsx index c03a7f2..aba3912 100644 --- a/src/components/panels/paged_ladder.jsx +++ b/src/components/panels/paged_ladder.jsx @@ -24,10 +24,10 @@ class PagedLadder extends React.Component {

Gold

{Object.keys(this.state).map((key) =>
-

{this.state[key].username}

-

{this.state[key].soldiers}

-

{this.state[key].recruits}

-

{this.state[key].gold}

+

{this.state[key].username}

+

{this.state[key].soldiers}

+

{this.state[key].recruits}

+

{this.state[key].gold}

)}
);