Last active
June 8, 2018 12:36
-
-
Save DenimTornado/8b7d1f074b7f19481e77988a046d446f to your computer and use it in GitHub Desktop.
Stats parser for FM + generate
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
// ==UserScript== | |
// @name New Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo | |
// @grant none | |
// ==/UserScript== | |
$(function( ) { | |
var table = ('.compare-players-table'); | |
var strings = $(table).find('tr'); | |
var stats = {}; | |
for(var i = 0; i < strings.length; i++) { | |
var tr = $(strings[i]); | |
var name = $(tr).find('th')[0]; | |
// console.log($(name)); | |
if (!!$(name).text()) { | |
var bstat = $(strings[i]).find('.text-left'); | |
var stat = $(bstat[0]).find('b'); | |
stats[$(name).text()] = $(stat[0]).html(); | |
} | |
} | |
var div = $('<div id="statsPop"></div>'); | |
$(div).css( "position", "absolute" ); | |
$(div).css( "background-color", "#fff" ); | |
$(div).css( "top", "60px" ); | |
$(div).css( "left", "0" ); | |
$(div).css( "z-index", "10" ); | |
$(div).css( "padding", "10px" ); | |
var table2 = $('<table></table>'); | |
var statsArrr = [ | |
"Acceleration", | |
"Aggression", | |
"Awareness", | |
"Ball Control", | |
"Crossing", | |
"Dribbling", | |
"Heading", | |
"Long Passing", | |
"Marking", | |
"Sprint Speed", | |
"Short Passing", | |
"Reflexes", | |
"Finishing", | |
"Shot Power", | |
"", | |
"Strength", | |
"Tackling", | |
"", | |
"", | |
"", | |
"Positioning", | |
"", | |
"", | |
"", | |
"", | |
"Composure", | |
"Handling", | |
"GK Positioning", | |
"Reactions", | |
"Long Shots", | |
"Free Kick Accuracy", | |
"GK Diving" | |
]; | |
var stat1 = ''; | |
var stat2 = ''; | |
var stat3 = ''; | |
for (var j = 0; j < statsArrr.length; j++) { | |
if (!!stats[statsArrr[j]]) { | |
$(table2).append('<tr><td>'+stats[statsArrr[j]]+'</td><td>'+statsArrr[j]+'</td></tr>'); | |
} else { | |
$(table2).append('<tr><td></td><td>?</td></tr>'); | |
} | |
if (j < 8) { | |
if (!!stats[statsArrr[j]]) { | |
if (stat1.length > 0) { | |
stat1 = stat1 + ';' + stats[statsArrr[j]]; | |
} else { | |
stat1 = stat1 + stats[statsArrr[j]]; | |
} | |
} | |
} | |
if (j >= 8 && j < 17) { | |
if (!!stats[statsArrr[j]]) { | |
if (stat2.length > 0) { | |
stat2 = stat2 + ';' + stats[statsArrr[j]]; | |
} else { | |
stat2 = stat2 + stats[statsArrr[j]]; | |
} | |
} | |
} | |
if (j > 19) { | |
if (!!stats[statsArrr[j]]) { | |
if (stat3.length > 0) { | |
stat3 = stat3 + ';' + stats[statsArrr[j]]; | |
} else { | |
stat3 = stat3 + stats[statsArrr[j]]; | |
} | |
} | |
} | |
} | |
var playerName = $('.card-col')[1]; | |
playerName = $(playerName).find('b')[0]; | |
playerName = $(playerName).html(); | |
var script = "gg.clearResults()</br>" + | |
"gg.searchNumber('"+stat1+"::29', gg.TYPE_DWORD)</br>" + | |
"gg.getResults(200)</br>" + | |
"gg.editAll('140', gg.TYPE_DWORD)</br>" + | |
"gg.clearResults()</br>" + | |
"gg.searchNumber('"+stat2+"::33', gg.TYPE_DWORD)</br>" + | |
"gg.getResults(200)</br>" + | |
"gg.editAll('140', gg.TYPE_DWORD)</br>" + | |
"gg.clearResults()</br>" + | |
"gg.searchNumber('"+stat3+"::45', gg.TYPE_DWORD)</br>" + | |
"gg.getResults(200)</br>" + | |
"gg.editAll('140', gg.TYPE_DWORD)</br>"; | |
$(div).append('--' + playerName + '</br>'); | |
$(div).append(script); | |
$(div).append('----------------</br>'); | |
$(div).append(table2); | |
$('body').append(div); | |
console.log(script); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment