Skip to content

Instantly share code, notes, and snippets.

@kurokikaze

kurokikaze/getCPS.js

Last active Dec 22, 2015
Embed
What would you like to do?
Получает текущий CPS по номеру варианта (0 - курсор, 1 - бабушка и т.д.) и цену следующего айтема по номеру.
var getCPS = function(num) {
var text = document.getElementById('rowInfoContent' + num.toString()).innerText.split('\n');
var count = parseInt(text[0].replace(/,/g, '').match(/\s(\d+)\s/)[1]);
var production = parseFloat(text[1].replace(/,/g, '').match(/\s([\d,.]+)\s/)[1]);
return production/count;
}
var getPrice = function(num) {
return parseInt(document.getElementById('product' + num.toString()).children[1].children[1].innerText.replace(/,/g,''))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment