noname/game/phantom.js

25 lines
622 B
JavaScript
Raw Normal View History

2016-04-27 15:01:25 +00:00
var load=function(id){
var page = require('webpage').create();
page.settings.userAgent = 'SpecialAgent';
2016-04-30 01:51:01 +00:00
page.open('http://localhost/index.html?server='+id, function(status) {
2016-04-27 15:01:25 +00:00
if(status !== 'success') {
console.log('Unable to access network');
}
setInterval(function(){
page.evaluate(function(){
if(!lib.node||!lib.node.clients||!lib.node.clients.length){
game.reload();
}
});
},3600000);
});
}
2016-04-26 02:34:31 +00:00
2016-04-27 15:01:25 +00:00
load(1);
2016-08-09 16:48:05 +00:00
// load(2);
// load(3);
2016-05-20 15:15:49 +00:00
setTimeout(function(){
phantom.exit();
},72000000);