Created
October 17, 2014 13:26
-
-
Save mickdekkers/c691cfe1d62dbfb861df to your computer and use it in GitHub Desktop.
Extract Dark Souls 2 Cost of Leveling from http://darksouls2.wikidot.com/level
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Code snippet to extract Dark Souls 2 Cost of Leveling from http://darksouls2.wikidot.com/level | |
*/ | |
// Load jQuery | |
(function(a){if(!a.jQuery){var d=document,b=d.createElement('script');b.src='//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';d.getElementsByTagName('head')[0].appendChild(b)}})(this); | |
// Set jQuery variable | |
$ = jQuery; | |
// Clean up tables | |
$('table.wiki-content-table>tbody').find('td:empty').remove(); | |
// Set array variable | |
var arrSouls = []; | |
// Grab tables 1-4 | |
for (var i = 0; i <= 3; i++) { | |
for (var j = 1; j <= 7; j = j+2) { | |
arrSouls = [].concat.apply(arrSouls, $('table.wiki-content-table>tbody:eq(' + i + ')>tr').find('td:eq(' + j + ')').map(function(){return $(this).text();})); | |
}; | |
}; | |
// Grab the last table | |
arrSouls = [].concat.apply(arrSouls, $('table.wiki-content-table>tbody:eq(4)>tr').find('td:eq(1)').map(function(){return $(this).text();})); | |
// Remove entry for level 999 because it's out of order | |
arrSouls.pop(); | |
// Output to console | |
console.log(JSON.stringify(arrSouls, undefined, 2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment