Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
rlstephenpoole committed May 18, 2017
2 parents affe623 + bdc3b60 commit e8d99ea
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
24 changes: 11 additions & 13 deletions lib/Parser/SummaryCombinedEndpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ module.exports = class SummaryCombinedEndpoint extends Endpoint {
regex = regex.exec(data.summonerId)
data.summonerId = !!regex && regex.length ? parseInt(regex[1]) : undefined

data.league = this.Strip($('.TierRank .tierRank').text())
data.leagueName = this.Strip($('.TierRank .LeagueRank').text())
data.lp = parseInt($('.TierInfo .LeaguePoints').text().replace(' LP',''))
data.league = this.Strip($('.TierRankInfo .tierRank').text())
data.leagueName = this.Strip($('.TierRankInfo .LeagueName').text())
data.lp = parseInt($('.TierRankInfo .LeaguePoints').text().replace(' LP',''))
if (!data.lp) data.lp = undefined
data.wins = parseInt($('.TierInfo .WinLose .wins').text().replace('W',''))
data.wins = parseInt($('.WinRatioTitle .win').text().replace('W',''))
if (!data.wins) data.wins = undefined
data.losses = parseInt($('.TierInfo .WinLose .losses').text().replace('L',''))
data.losses = parseInt($('.WinRatioTitle .lose').text().replace('L',''))
if (!data.losses) data.losses = undefined
data.winRatio = parseInt($('.TierInfo .WinLose .winratio').text().replace('Win Ratio ',''))
data.winRatio = parseInt($('.WinRatioGraph .Text').text().replace('%',''))
if (!data.winRatio) data.winRatio = undefined

recent.winRatio = parseInt($('.GameAverageStats .WinRatioText').text().slice(0,-1))
recent.winRatio = parseInt($('.GameAverageStats .WinRatioGraph .Text').text().slice(0,-1))

var temp = $('.GameAverageStats .WinRatioTitle').text().split('\n')

Expand All @@ -42,11 +42,8 @@ module.exports = class SummaryCombinedEndpoint extends Endpoint {
recent.deathsAverage = parseFloat($('.GameAverageStats .KDA .Death').text())
recent.assistsAverage = parseFloat($('.GameAverageStats .KDA .Assist').text())
recent.kdaRatio = parseFloat($('.GameAverageStats .KDARatio .KDARatio').text().slice(0,-2))
recent.killParticipation = $('.GameAverageStats .KDARatio .CKRate').text()
var regex = new RegExp(/tion (\d*)%/g)
regex = regex.exec(recent.killParticipation)
if (!!regex && regex.length) recent.killParticipation = parseInt(regex[1])
else recent.killParticipation = undefined
recent.killParticipation = parseInt($('.GameAverageStats .KDARatio .CKRate span').text().replace('%', ''))

data.recent = recent

var games = []
Expand Down Expand Up @@ -74,6 +71,7 @@ module.exports = class SummaryCombinedEndpoint extends Endpoint {
game.deaths = parseInt(this.Strip($('.KDA .Death').text()))
game.assists = parseInt(this.Strip($('.KDA .Assist').text()))
game.ratio = parseFloat(this.Strip($('.KDARatio .KDARatio').text()).slice(0,-2))
if (isNaN(game.ratio)) game.ratio = 0
// game.multikill = this.Strip($('.multikill .kill').text())
game.level = parseInt(this.Strip($('.Stats .Level').text().replace('Level','')))

Expand All @@ -84,7 +82,7 @@ module.exports = class SummaryCombinedEndpoint extends Endpoint {
else {game.csps = -1}
// game.gold = this.Strip($('.gold .gold').text())
// game.wardsGreenBought = parseInt(this.Strip($('.wards.sight').text()))
game.pinksPurchased = parseInt(this.Strip($('.wards.vision').text()))
game.pinksPurchased = parseInt(this.Strip($('.wards.vision').text())) || 0
game.killParticipation = parseInt(this.Strip($('.CKRate').text().replace('P/Kill ','')))

var items = []
Expand Down
2 changes: 1 addition & 1 deletion lib/Parser/SummaryRankedEndpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports = class SummaryRankedEndpoint extends Endpoint {
else {game.csps = -1}
// game.gold = this.Strip($('.gold .gold').text())
// game.wardsGreenBought = parseInt(this.Strip($('.wards.sight').text()))
game.pinksPurchased = parseInt(this.Strip($('.wards.vision').text()))
game.pinksPurchased = parseInt(this.Strip($('.wards.vision').text())) || 0
game.killParticipation = parseInt(this.Strip($('.CKRate').text().replace('P/Kill ','')))

var items = []
Expand Down

0 comments on commit e8d99ea

Please sign in to comment.