Skip to content

Instantly share code, notes, and snippets.

@longlho
Last active August 29, 2015 14:24
Show Gist options
  • Save longlho/b8efc22bcb79ebbcdc1d to your computer and use it in GitHub Desktop.
Save longlho/b8efc22bcb79ebbcdc1d to your computer and use it in GitHub Desktop.
Kittens scripts
(function () {
var res = window.gamePage.resPool.resources;
function findRes (type) {
return res.filter(function (r) {
return r.name === type;
})[0];
}
function setRes (type, amt) {
var obj = findRes(type);
obj.value = amt || obj.maxValue;
}
function maxAll (isVisible) {
isVisible || (isVisible = true);
res.forEach(function (r) {
if (r.visible === isVisible) {
r.value = r.maxValue;
}
});
}
window.__maxAll = maxAll;
window.__findRes = findRes;
window.__res = res;
window.setRes = setRes;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment