Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Commit

Permalink
fix champion.gg rune mapping changes
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeNote committed Aug 25, 2018
1 parent aa16894 commit 3054c42
Showing 1 changed file with 78 additions and 10 deletions.
88 changes: 78 additions & 10 deletions plugins/championgg.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,91 @@ var cheerio = require('cheerio');
var url = "http://champion.gg";

var stylesMap = {
"icon-p":8000,
"icon-d":8100,
"icon-s":8200,
"icon-r":8400,
"icon-i":8300
"Precision":8000,
"Domination":8100,
"Sorcery":8200,
"Resolve":8300,
"Inspiration":8400
};

var perksMap = {
"Press the Attack":8005,
"Lethal Tempo":8008,
"Fleet Footwork":8021,
"Conqueror":8010,
"Overheal":9101,
"Triumph":9111,
"Presence of Mind":8009,
"Legend: Alacrity":9104,
"Legend: Tenacity":9105,
"Legend: Bloodline":9103,
"Coup de Grace":8014,
"Cut Down":8017,
"Last Stand":8299,
"Electrocute":8112,
"Predator":8124,
"Dark Harvest":8128,
"Cheap Shot":8126,
"Taste of Blood":8139,
"Sudden Impact":8143,
"Zombie Ward":8136,
"Ghost Poro":8120,
"Eyeball Collection":8138,
"Ravenous Hunter":8135,
"Ingenious Hunter":8134,
"Relentless Hunter":8105,
"Summon Aery":8214,
"Arcane Comet":8229,
"Phase Rush":8230,
"Nullifying Orb":8224,
"Manaflow Band":8226,
"The Ultimate Hat":8243,
"Transcendence":8210,
"Celerity":8234,
"Absolute Focus":8233,
"Scorch":8237,
"Waterwalking":8232,
"Gathering Storm":8236,
"Grasp of the Undying":8437,
"Aftershock":8439,
"Guardian":8465,
"Unflinching":8242,
"Demolish":8446,
"Font of Life":8463,
"Chrysalis":8472,
"Conditioning":8429,
"Overgrowth":8451,
"Revitalize":8453,
"Second Wind":8444,
"Unsealed Spellbook":8360,
"Glacial Augment":8351,
"Kleptomancy":8359,
"Hextech Flashtraption":8306,
"Biscuit Delivery":8345,
"Perfect Timing":8313,
"Magical Footwear":8304,
"Future's Market":8321,
"Minion Dematerializer":8316,
"Cosmic Insight":8347,
"Approach Velocity":8410,
"Celestial Body":8339,
"Bone Plating":8473,
"Time Warp Tonic":8352,
"Hail of Blades":9923,
"Ultimate Hunter":8106,
"Nimbus Cloak":8275
};

function exctractPage(html, champion, rec, callback, pageType) {
var $ = cheerio.load(html);

var pages = [];
var runecount = -1;
var slots = $("div[class^=Slot__LeftSide]");
var slots = $("div[class^=Slot__RightSide]");

var role = $(`li[class^='selected-role'] a[href^='/champion/${champion}']`).first();

$("img[src^='https://s3.amazonaws.com/solomid-cdn/league/runes_reforged/']", slots).each(function(index) {
$("div[class*='Description__Title']", slots).each(function(index) {
if(index % 8 == 0) {
pages.push({
"name": $(".champion-profile h1").text() + " " + role.text().trim() + (Math.floor(runecount / 6) ? " HW" : " MF"),
Expand All @@ -37,9 +105,9 @@ function exctractPage(html, champion, rec, callback, pageType) {
}
})
}
var rune = $(this).attr("src");
rune = rune.replace("https://s3.amazonaws.com/solomid-cdn/league/runes_reforged/", "");
var rune = $(this).text();
rune = rune.replace(".png", "");

if(index % 8 == 0) {
pages[pages.length - 1].primaryStyleId = stylesMap[rune];
return;
Expand All @@ -50,7 +118,7 @@ function exctractPage(html, champion, rec, callback, pageType) {
}
else runecount++;

pages[pages.length - 1].selectedPerkIds[runecount % 6] = parseInt(rune);
pages[pages.length - 1].selectedPerkIds[runecount % 6] = perksMap[rune];
});

if(rec) {
Expand Down

0 comments on commit 3054c42

Please sign in to comment.