Skip to content

Instantly share code, notes, and snippets.

@mickdekkers
Created October 17, 2014 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mickdekkers/c691cfe1d62dbfb861df to your computer and use it in GitHub Desktop.
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
/*
* 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