Skip to content

Commit

Permalink
Merge f3afac5 into 10b0828
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Voboril committed Sep 24, 2019
2 parents 10b0828 + f3afac5 commit d500f70
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ lib-cov

# Coverage directory used by tools like istanbul
coverage
.nyc_output/

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand Down
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ cache:
notifications:
email: false
node_js:
- node
- "lts/*"
- "8.9.0"
- "8.16.0"
- "9.11.2"
- "10.16.0"
- "lts/*"
- node

before_script:
- greenkeeper-lockfile-update
Expand All @@ -24,6 +24,7 @@ branches:
stages:
- lint
- test
- coverage
- release

jobs:
Expand All @@ -32,6 +33,8 @@ jobs:
script: npm run lint
- stage: test
script: npm test
- stage: coverage
script: npm run coverage
- stage: release
node_js: node
deploy:
Expand Down
6 changes: 3 additions & 3 deletions lib/DarkSector.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ class DarkSector extends WorldstateObject {
* The remaining health of the current solar rail
* @type {number}
*/
this.defenderPoolRemaining = data.DefenderInfo.StrengthRemaining;
this.defenderPoolRemaining = Number.parseFloat(data.DefenderInfo.StrengthRemaining);

/**
* The maximum health of the solar rail
* @type {number}
*/
this.defenderMaxPool = data.DefenderInfo.MaxStrength;
this.defenderMaxPool = Number.parseFloat(data.DefenderInfo.MaxStrength);

/**
* The date and time at which the rail was deployed
Expand Down Expand Up @@ -108,7 +108,7 @@ class DarkSector extends WorldstateObject {

this.defenderRailHealReserve = data.DefenderInfo.RailHealReserve;

this.healRate = data.DefenderInfo.healRate;
this.healRate = Number.parseFloat(data.DefenderInfo.healRate);

this.damagePerMission = data.DefenderInfo.DamagePerMission;

Expand Down
2 changes: 1 addition & 1 deletion lib/PersistentEnemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PersistentEnemy extends WorldstateObject {
* The enemy's remainaing health percentage
* @type {number}
*/
this.healthPercent = data.HealthPercent;
this.healthPercent = Number.parseFloat(data.HealthPercent);

/**
* The percentual damage that the enemy takes when it's defeated
Expand Down
17 changes: 9 additions & 8 deletions lib/WorldEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,25 @@ class WorldEvent extends WorldstateObject {
* The event's main score goal
* @type {number}
*/
this.maximumScore = data.Goal;
this.maximumScore = Number.parseInt(data.Goal, 10);

/**
* The current score on the event
* @type {number}
*/
this.currentScore = data.Count;
this.currentScore = Number.parseInt(data.Count, 10);

/**
* The first intermediate score goal
* @type {?number}
*/
this.smallInterval = data.GoalInterim;
this.smallInterval = Number.parseInt(data.GoalInterim, 10);

/**
* The second intermediate score goal
* @type {?number}
*/
this.largeInterval = data.GoalInterim2;
this.largeInterval = Number.parseInt(data.GoalInterim2, 10);

/**
* The faction that the players must fight in the event
Expand Down Expand Up @@ -155,7 +155,7 @@ class WorldEvent extends WorldstateObject {
* @type {Number}
*/
this.health = typeof data.HealthPct !== 'undefined'
? ((data.HealthPct || 0.00) * 100).toFixed(2)
? Number.parseFloat(((data.HealthPct || 0.00) * 100).toFixed(2))
: undefined;

if (data.JobAffiliationTag) {
Expand All @@ -174,7 +174,7 @@ class WorldEvent extends WorldstateObject {
(data.InterimRewards || []).forEach((reward, index) => {
const msg = ((data.InterimRewardMessages || [])[index] || {});
this.interimSteps[index] = {
goal: data.InterimGoals[index],
goal: Number.parseInt(data.InterimGoals[index], 10),
reward: reward ? new Reward(reward, opts) : undefined,
message: {
sender: translator.languageString(msg.sender, locale),
Expand All @@ -197,15 +197,16 @@ class WorldEvent extends WorldstateObject {
data.Types.forEach((type, index) => {
this.progressSteps[index] = {
type: translator.languageString(type, locale),
progressAmt: data.MultiProgress[index],
progressAmt: Number.parseInt(data.MultiProgress[index], 10),
};
});

/**
* Total of all MultiProgress
* @type {Number}
*/
this.progressTotal = data.MultiProgress.reduce((accumulator, val) => accumulator + val);
this.progressTotal = Number.parseFloat(data.MultiProgress
.reduce((accumulator, val) => accumulator + val));
}

/**
Expand Down
40 changes: 24 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
"chai": "^4.2.0",
"eslint": "^6.1.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-import-resolver-node": "^0.3.2",
"eslint-plugin-import": "^2.18.2",
"greenkeeper-lockfile": "^1.15.1",
"ink-docstrap": "^1.3.2",
"jsdoc": "^3.6.3",
"mocha": "^6.2.0",
"rewire": "^4.0.0",
"sinon": "^7.4.1",
"sinon-chai": "3.3.0",
"sinon": "^7.5.0",
"sinon-chai": "^3.3.0",
"tsd-jsdoc": "^2.3.1"
},
"engines": {
"node": ">=8.9.0"
},
"scripts": {
"test": "npx mocha --exit",
"build-docs": "node_modules/.bin/jsdoc -c jsdoc-config.json -d docs",
"test": "npx nyc --reporter=html --reporter=text mocha --exit",
"coverage": "npm test && npx nyc report --reporter=text-lcov | npx coveralls",
"build-docs": "npx jsdoc -c jsdoc-config.json -d docs",
"lint": "npx eslint main.js lib/ test/",
"lint:fix": "npx eslint main.js lib/ test/ --fix"
},
Expand Down

0 comments on commit d500f70

Please sign in to comment.