oversmash
Advanced tools
Comparing version 1.5.2 to 1.5.3
@@ -211,11 +211,19 @@ 'use strict'; | ||
function extractCompetitiveRanks(options, p) { | ||
// Role ranks don't appear to have identifying elements, so we must rely on the | ||
// order they appear in the DOM | ||
const roleRanks = p('.masthead-player-progression div.competitive-rank-level'); | ||
// Role ranks don't appear to have identifying classes or IDs, so we have to rely on | ||
// the tooltip text value of a neighboring element | ||
const roleRanks = p('.competitive-rank .competitive-rank-role'); | ||
let roles = { tank: null, damage: null, support: null }; | ||
return { | ||
tank: normalizeValue(options, roleRanks.eq(0).text()), | ||
damage: normalizeValue(options, roleRanks.eq(1).text()), | ||
support: normalizeValue(options, roleRanks.eq(2).text()) | ||
}; | ||
roleRanks.each(function () { | ||
const $el = (0, _cheerio2.default)(this); | ||
const roleText = $el.find('.competitive-rank-tier-tooltip').data('ow-tooltip-text'); | ||
const level = $el.find('.competitive-rank-level').text(); | ||
// 'Damage Skill Rating' -> 'Damage' -> 'damage' | ||
const role = roleText.split(' ')[0].toLowerCase(); | ||
roles[role] = normalizeValue(options, level); | ||
}); | ||
return roles; | ||
} | ||
@@ -222,0 +230,0 @@ |
@@ -0,1 +1,7 @@ | ||
# 1.5.3 | ||
1.5.3 | ||
- Fixes a bug where users who had not completed all placements for the season could have incorrect or invalid role rank values | ||
# 1.5.2 | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "oversmash", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/filp/oversmash", |
@@ -43,3 +43,3 @@ # oversmash [![npm version](https://badge.fury.io/js/oversmash.svg)](https://badge.fury.io/js/oversmash) | ||
// | ||
ow.player('bob-12345').then(player => { | ||
ow.player('bob#12345').then(player => { | ||
console.log(player) | ||
@@ -49,3 +49,3 @@ }) | ||
// Output: | ||
// { name: 'bob-12345', | ||
// { name: 'bob#12345', | ||
// accounts: | ||
@@ -60,3 +60,3 @@ // [ { level: 440, | ||
// current competitive rank | ||
ow.playerStats('bob-12345', 'pc').then(player => { | ||
ow.playerStats('bob#12345', 'pc').then(player => { | ||
console.log(player) | ||
@@ -66,7 +66,9 @@ }) | ||
// Output: | ||
// { name: 'bob-12345', | ||
// { name: 'bob#12345', | ||
// region: 'us', | ||
// platform: 'pc', | ||
// stats: | ||
// { competitiveRank: 3700, | ||
// { competitiveRank: { support: 1234, tank: 1234, damage: 1234 }, | ||
// endorsementLevel: 3, | ||
// gamesWon: 2500, | ||
// achievements: | ||
@@ -145,3 +147,3 @@ // [ { name: 'centenary', achieved: true }, | ||
`oversmash` uses [debug](https://github.com/visionmedia/debug). Run your code calling oversmash with | ||
`DEBUG=oversmash` to enable debug logging | ||
`DEBUG=oversmash:*` to enable debug logging | ||
@@ -148,0 +150,0 @@ ## Stuff 🐝 🐝 🐝 |
@@ -1,1 +0,1 @@ | ||
{"name":"FATCOTTON420#2476","nameEscaped":"FATCOTTON420-2476","nameEscapedUrl":"FATCOTTON420%232476","accounts":[{"level":973,"portrait":"https://d1u1mce87gyfbn.cloudfront.net/game/unlocks/0x02500000000017AE.png","platform":"pc","public":true}]} | ||
{"name":"FATCOTTON420#2476","nameEscaped":"FATCOTTON420-2476","nameEscapedUrl":"FATCOTTON420%232476","accounts":[{"level":983,"portrait":"https://d1u1mce87gyfbn.cloudfront.net/game/unlocks/0x02500000000017AE.png","platform":"pc","public":true}]} |
Sorry, the diff of this file is too big to display
144988
400
150