NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name City Find Hax
// @namespace City Find Hax
// @version 0.3
// @description
// @author AquaRegia
// @match http://www.torn.com/city.php*
// @match https://www.torn.com/city.php*
// @match http://torn.com/city.php*
// @match https://torn.com/city.php*
// ==/UserScript==
jQuery(window).load(function()
{
jQuery.get(document.location.protocol + "//www.torn.com/city.php?step=mapData&dataType=json", function(json)
{
var data = JSON.parse(atob(JSON.parse(json).territoryUserItems));
console.log(data);
jQuery("h4").after
(
jQuery("<div></div>").html
(
"Number of items currently in the city: " + data.length +
"<br/>" +
"Latest item spawned: " + (data.length > 0 ? data[data.length-1].title : "Nothing, not even a shitty kitten plushie :(") +
(data.length > 1 ? (
"<br/>" +
"Spawn rate (all time): " + function(a, b)
{
return ((a - b)/(data.length - 1)/3600).toFixed(1) + " hours per spawn";
}(parseInt(data[data.length-1].ts, 36), parseInt(data[0].ts, 36)) +
"<br/>" +
"Spawn rate (last " + Math.min(5, data.length) + "): " + function(a, b)
{
return ((a - b)/(Math.min(5, data.length) - 1)/3600).toFixed(1) + " hours per spawn";
}(parseInt(data[data.length-1].ts, 36), parseInt(data[data.length-(Math.min(5, data.length))].ts, 36))) : "")
).css("clear", "left")
.css("margin-bottom", "-20px")
);
});
});