mirror of
https://github.com/gooba42/adventureland.git
synced 2026-10-14 18:39:27 -05:00
Open source
This commit is contained in:
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
@@ -0,0 +1,109 @@
|
||||
var { workerData, parentPort } = require('worker_threads');
|
||||
if(!workerData) // for chrome://inspect with "node --expose-gc --inspect character.js"
|
||||
{
|
||||
workerData={
|
||||
"name":"NewWarrior",
|
||||
"region":"EU",
|
||||
"server":"I",
|
||||
"code":"cli_tests",
|
||||
"auth":"5818821692620800-gjxqztPovvpiaKTGnjEtT",
|
||||
};
|
||||
parentPort={postMessage:function(){},on:function(){}};
|
||||
|
||||
//jsdomDevtoolsFormatter = require('jsdom-devtools-formatter');
|
||||
//jsdomDevtoolsFormatter.install();
|
||||
}
|
||||
// In CODE, you can: parent.CLI_OUT.push({"type":"custom_type",data:{}}) - it's propagated to the below routine, and if not handled, to master.js
|
||||
console.log(workerData.name);
|
||||
global.gc();
|
||||
|
||||
var jsdom,request,localstorager,localStorage=null;
|
||||
try{
|
||||
jsdom=require("jsdom");
|
||||
}catch(e){
|
||||
console.log("You need to run: npm install jsdom");
|
||||
process.exit();
|
||||
}
|
||||
var { JSDOM }=jsdom;
|
||||
try{
|
||||
request=require('request');
|
||||
}catch(e){
|
||||
console.log("You need to run: npm install request");
|
||||
process.exit();
|
||||
}
|
||||
try{
|
||||
localstorager=require('node-localstorage').LocalStorage;
|
||||
localStorage=new localstorager("./storage");
|
||||
}catch(e){
|
||||
console.log("You need to run: npm install node-localstorage for functioning localStorage support!");
|
||||
}
|
||||
|
||||
var base_url="http://thegame.com";
|
||||
|
||||
var url=base_url+"/character/"+workerData.name+"/in/"+workerData.region+"/"+workerData.server+"/?no_html=bot&is_bot=1&is_cli=1&code="+workerData.code+"&auth="+workerData.auth;
|
||||
var dom=false,code_active=false;
|
||||
|
||||
request(url, (error, response, body) => {
|
||||
var virtualConsole=new jsdom.VirtualConsole();
|
||||
virtualConsole.sendTo(console);
|
||||
|
||||
var options={
|
||||
url:url,
|
||||
pretendToBeVisual:true,
|
||||
includeNodeLocations: true,
|
||||
resources:'usable',
|
||||
runScripts:'dangerously',
|
||||
virtualConsole:virtualConsole,
|
||||
beforeParse:function(window){}
|
||||
}
|
||||
dom=new JSDOM(body,options);
|
||||
dom.name=workerData.name;
|
||||
if(localStorage && !dom.window.ls_emulation) dom.window.ls_emulation=localStorage;
|
||||
dom.window.cli_require=require;
|
||||
//console.log(dom.window.document.body.innerHTML);
|
||||
});
|
||||
|
||||
setInterval(function(){
|
||||
if(!dom || !dom.window.game_logs) return;
|
||||
if(dom.window.character) dom.name=dom.window.character.name;
|
||||
|
||||
dom.window.game_logs.forEach(function(l){
|
||||
console.log(dom.name+"[LOG] "+l[0]);
|
||||
});
|
||||
dom.window.game_logs=[];
|
||||
dom.window.game_chats.forEach(function(c){
|
||||
console.log(dom.name+"[CHAT] "+c[0]+": "+c[1]);
|
||||
});
|
||||
dom.window.game_chats=[];
|
||||
dom.window.CLI_OUT.forEach(function(m){
|
||||
if(m.type=="kill") process.exit(1);
|
||||
else if(m.type=="time_kill")
|
||||
{
|
||||
console.log("[CLI] You need to purchase CLI time from the Main Menu (currently: parent.api_call(\"cli_time\"))");
|
||||
parentPort.postMessage({"type":"kill"});
|
||||
}
|
||||
else parentPort.postMessage(m);
|
||||
});
|
||||
dom.window.CLI_OUT=[];
|
||||
if(!code_active && dom.window.code_active) code_active=true,parentPort.postMessage({"type":"code_active"});
|
||||
},10);
|
||||
|
||||
parentPort.on("message",function(data){
|
||||
dom.window.CLI_IN.push(data);
|
||||
});
|
||||
|
||||
setInterval(function(){
|
||||
if(dom && dom.window.character && dom.window.socket && (new Date()-dom.window.last_ping)<30000)
|
||||
parentPort.postMessage({type:"update"});
|
||||
},1000);
|
||||
|
||||
setInterval(function(){
|
||||
if (process.memoryUsage().heapUsed > 150000000) {
|
||||
global.gc(true);
|
||||
console.log("["+workerData.name+"] Manual GC");
|
||||
}
|
||||
},20000);
|
||||
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
// console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
var puppeteer = require('puppeteer');
|
||||
var { workerData, parentPort } = require('worker_threads');
|
||||
if(!workerData) // for chrome://inspect with "node --expose-gc --inspect character.js"
|
||||
{
|
||||
workerData={
|
||||
"name":"Wizard",
|
||||
"region":"EU",
|
||||
"server":"I",
|
||||
"code":"PhoenixHunter",
|
||||
"auth":"5818821692620800-gjxqztPovvpiaKTGnjEtT",
|
||||
};
|
||||
parentPort={postMessage:function(){},on:function(){}};
|
||||
|
||||
//jsdomDevtoolsFormatter = require('jsdom-devtools-formatter');
|
||||
//jsdomDevtoolsFormatter.install();
|
||||
}
|
||||
// In CODE, you can: parent.CLI_OUT.push({"type":"custom_type",data:{}}) - it's propagated to the below routine, and if not handled, to master.js
|
||||
|
||||
var base_url="http://thegame.com";
|
||||
|
||||
var url=base_url+"/character/"+workerData.name+"/in/"+workerData.region+"/"+workerData.server+"/?no_html=1&code="+workerData.code+"&auth="+workerData.auth;
|
||||
var dom=false,code_active=false;
|
||||
|
||||
(async () => {
|
||||
console.log(workerData.name);
|
||||
const browser = await puppeteer.launch({args:["--disable-gpu","--disable-gpu-compositing","--disable-accelerated-2d-canvas","--ignore-gpu-blacklist","--headless"]});
|
||||
const page = await browser.newPage();
|
||||
page.on('console', msg => console.log('PAGE LOG:', msg.text()));
|
||||
await page.goto(url);
|
||||
console.log("Loaded page.");
|
||||
})();
|
||||
|
||||
setInterval(function(){
|
||||
|
||||
},1);
|
||||
@@ -0,0 +1,218 @@
|
||||
var is_server=0;
|
||||
var character={
|
||||
x:0, real_x:0,
|
||||
y:0, real_y:0,
|
||||
map:"main",
|
||||
base:{h: 8, v: 7, vn: 2},
|
||||
processor:true,
|
||||
}
|
||||
var smart={
|
||||
moving:false,
|
||||
map:"main",x:0,y:0,
|
||||
on_done:function(){},
|
||||
plot:null,
|
||||
edge:20, // getting 20px close to the target is enough
|
||||
baby_edge:80, // start treading lightly when 60px close to the target or starting point
|
||||
try_exact_spot: false,
|
||||
use_town:false,
|
||||
prune:{
|
||||
smooth:true,
|
||||
map:true,
|
||||
},
|
||||
flags:{}
|
||||
};
|
||||
|
||||
function game_log(x)
|
||||
{
|
||||
console.log("[MGL]: "+x);
|
||||
}
|
||||
|
||||
var queue=[],visited={},start=0,best=null;
|
||||
var moves=[[0,15],[0,-15],[15,0],[-15,0]];
|
||||
var baby_steps=[[0,5],[0,-5],[5,0],[-5,0]];
|
||||
// baby_steps is a new logic, used just around the target or starting point, to get out of tough spots [08/03/19]
|
||||
|
||||
function plot(index)
|
||||
{
|
||||
if(index==-1) return;
|
||||
plot(queue[index].i); // Recursively back-tracks the path we came from
|
||||
smart.plot.push(queue[index]);
|
||||
}
|
||||
|
||||
function qpush(node)
|
||||
{
|
||||
// If we haven't visited this location, adds the location to the queue
|
||||
if(smart.prune.map && smart.flags.map && node.map!=smart.map) return;
|
||||
if(visited[node.map+"-"+node.x+"-"+node.y]) return;
|
||||
if(!node.i) node.i=start; // set the index, to aid the plot function
|
||||
queue.push(node);
|
||||
visited[node.map+"-"+node.x+"-"+node.y]=true;
|
||||
}
|
||||
|
||||
function smooth_path()
|
||||
{
|
||||
var i=0,j;
|
||||
while(i<smart.plot.length)
|
||||
{
|
||||
// Assume the path ahead is [i] [i+1] [i+2] - This routine checks whether [i+1] could be skipped
|
||||
// The resulting path is smooth rather than rectangular and bumpy
|
||||
// Try adding "function smooth_path(){}" or "smart.prune.smooth=false;" to your Code
|
||||
// [06/07/18]: (!smart.plot[i+2] || !smart.plot[i+2].transport) - without this condition, in "winterland", move(-160,-660), smart_move("main") fails
|
||||
while(i+2<smart.plot.length && smart.plot[i].map==smart.plot[i+1].map && smart.plot[i].map==smart.plot[i+1].map && (!smart.plot[i+2] || !smart.plot[i+2].transport) &&
|
||||
can_move({map:smart.plot[i].map,x:smart.plot[i].x,y:smart.plot[i].y,going_x:smart.plot[i+2].x,going_y:smart.plot[i+2].y,base:character.base}))
|
||||
smart.plot.splice(i+1,1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
function bfs()
|
||||
{
|
||||
var timer=new Date(),result=null,optimal=true;
|
||||
|
||||
while(start<queue.length)
|
||||
{
|
||||
var current=queue[start];
|
||||
// game_log(current.x+" "+current.y);
|
||||
var map=G.maps[current.map];
|
||||
var c_moves=moves,qlist=[];
|
||||
if(current.map==smart.map)
|
||||
{
|
||||
var c_dist=abs(current.x-smart.x)+abs(current.y-smart.y);
|
||||
var s_dist=abs(current.x-smart.start_x)+abs(current.y-smart.start_y);
|
||||
smart.flags.map=true;
|
||||
if(c_dist<smart.baby_edge || s_dist<smart.baby_edge) c_moves=baby_steps;
|
||||
if(c_dist<smart.edge)
|
||||
{
|
||||
result=start;
|
||||
break;
|
||||
}
|
||||
else if(best===null || abs(current.x-smart.x)+abs(current.y-smart.y)<abs(queue[best].x-smart.x)+abs(queue[best].y-smart.y))
|
||||
{
|
||||
best=start;
|
||||
}
|
||||
}
|
||||
else if(current.map!=smart.map)
|
||||
{
|
||||
if(smart.prune.map && smart.flags.map) {start++; continue;}
|
||||
map.doors.forEach(function(door){
|
||||
// if(simple_distance({x:map.spawns[door[6]][0],y:map.spawns[door[6]][1]},{x:current.x,y:current.y})<30)
|
||||
if(smart.map!="bank" && door[4]=="bank" && !G.maps[current.map].mount || door[8]=="complicated") return; // manually patch the bank shortcut
|
||||
if(is_door_close(current.map,door,current.x,current.y) && can_use_door(current.map,door,current.x,current.y))
|
||||
qlist.push({map:door[4],x:G.maps[door[4]].spawns[door[5]||0][0],y:G.maps[door[4]].spawns[door[5]||0][1],transport:true,s:door[5]||0});
|
||||
});
|
||||
map.npcs.forEach(function(npc){
|
||||
if(npc.id=="transporter" && simple_distance({x:npc.position[0],y:npc.position[1]},{x:current.x,y:current.y})<75)
|
||||
{
|
||||
for(var place in G.npcs.transporter.places)
|
||||
{
|
||||
qlist.push({map:place,x:G.maps[place].spawns[G.npcs.transporter.places[place]][0],y:G.maps[place].spawns[G.npcs.transporter.places[place]][1],transport:true,s:G.npcs.transporter.places[place]});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(smart.use_town) qpush({map:current.map,x:map.spawns[0][0],y:map.spawns[0][1],town:true}); // "town"
|
||||
|
||||
shuffle(c_moves);
|
||||
c_moves.forEach(function(m){
|
||||
var new_x=current.x+m[0],new_y=current.y+m[1];
|
||||
// game_log(new_x+" "+new_y);
|
||||
// utilise can_move - game itself uses can_move too - smart_move is slow as can_move checks all the lines at each step
|
||||
if(can_move({map:current.map,x:current.x,y:current.y,going_x:new_x,going_y:new_y,base:character.base}))
|
||||
qpush({map:current.map,x:new_x,y:new_y});
|
||||
});
|
||||
qlist.forEach(function(q){qpush(q);}); // So regular move's are priotised
|
||||
|
||||
start++;
|
||||
}
|
||||
|
||||
if(result===null)
|
||||
{
|
||||
result=best,optimal=false;
|
||||
game_log("Path not found!","#CF575F");
|
||||
smart.moving=false;
|
||||
smart.success=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
plot(result);
|
||||
if(1) // [08/03/19] - to attempt and move to the actual coordinates
|
||||
{
|
||||
var last=smart.plot[smart.plot.length-1]; if(!last) last={map:character.map,x:character.real_x,y:character.real_y};
|
||||
if(smart.x!=last.x || smart.y!=last.y)
|
||||
{
|
||||
smart.try_exact_spot=true;
|
||||
smart.plot.push({map:last.map,x:smart.x,y:smart.y});
|
||||
}
|
||||
}
|
||||
smart.found=true;
|
||||
if(smart.prune.smooth) smooth_path();
|
||||
if(optimal) game_log("Path found!","#C882D1");
|
||||
else game_log("Path found~","#C882D1");
|
||||
// game_log(queue.length);
|
||||
smart.moving=false;
|
||||
smart.success=true;
|
||||
}
|
||||
}
|
||||
|
||||
function start_pathfinding()
|
||||
{
|
||||
smart.try_exact_spot=false;
|
||||
smart.searching=true;
|
||||
smart.start_x=character.real_x;
|
||||
smart.start_y=character.real_y;
|
||||
queue=[],visited={},start=0,best=null;
|
||||
qpush({x:character.real_x,y:character.real_y,map:character.map,i:-1});
|
||||
game_log("Searching for a path...","#89D4A2");
|
||||
bfs();
|
||||
}
|
||||
|
||||
function continue_pathfinding()
|
||||
{
|
||||
bfs();
|
||||
}
|
||||
|
||||
function smart_move_logic()
|
||||
{
|
||||
if(!smart.moving) return;
|
||||
if(!smart.searching && !smart.found)
|
||||
{
|
||||
start_pathfinding();
|
||||
}
|
||||
else if(!smart.found)
|
||||
{
|
||||
continue_pathfinding();
|
||||
}
|
||||
else if(!character.moving && can_walk(character) && !is_transporting(character))
|
||||
{
|
||||
if(!smart.plot.length)
|
||||
{
|
||||
smart.moving=false;
|
||||
smart.on_done(true);
|
||||
return;
|
||||
}
|
||||
var current=smart.plot[0];
|
||||
smart.plot.splice(0,1);
|
||||
// game_log(JSON.stringify(current));
|
||||
if(current.town)
|
||||
{
|
||||
use("town");
|
||||
}
|
||||
else if(current.transport)
|
||||
{
|
||||
parent.socket.emit("transport",{to:current.map,s:current.s});
|
||||
parent.push_deferred("transport");
|
||||
// use("transporter",current.map);
|
||||
}
|
||||
else if(character.map==current.map && (smart.try_exact_spot && !smart.plot.length || can_move_to(current.x,current.y)))
|
||||
{
|
||||
// game_log("S "+current.x+" "+current.y);
|
||||
move(current.x,current.y);
|
||||
}
|
||||
else
|
||||
{
|
||||
game_log("Lost the path...","#CF5B5B");
|
||||
smart_move({map:smart.map,x:smart.x,y:smart.y},smart.on_done);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
const { Worker, SHARE_ENV } = require('worker_threads');
|
||||
// parent.api_call("cli_time") to purchase 7 days for 29 shells. The rates will go up
|
||||
// IMPORTANT: RUN AS
|
||||
// node --expose-gc master.js
|
||||
// for global.gc();
|
||||
var G=null;
|
||||
var fs=require("fs");
|
||||
eval(""+fs.readFileSync("../../js/common_functions.js")); // Manually copy/paste common_functions.js from libraries/ to this directory
|
||||
eval(""+fs.readFileSync("functions.js"));
|
||||
|
||||
var auth="5818821692620800-gjxqztPovvpiaKTGnjEtT"; // show_json(parent.Cookies.get("auth"))
|
||||
var characters=[
|
||||
{
|
||||
"name":"GG",
|
||||
"region":"EU",
|
||||
"server":"I",
|
||||
"code":"local_cm_receiver",
|
||||
},
|
||||
{
|
||||
"name":"MERC",
|
||||
"region":"EU",
|
||||
"server":"I",
|
||||
"code":"local_cm_sender",
|
||||
},
|
||||
];
|
||||
|
||||
function run_character(workerData)
|
||||
{
|
||||
console.log(workerData);
|
||||
const worker = new Worker('./character.js', { workerData:workerData, env: SHARE_ENV, execArgv:["expose-gc","inspect"]});
|
||||
worker.on('message',function(data){
|
||||
if(data.type=="update")
|
||||
worker.info.last_update=new Date();
|
||||
else if(data.type=="smart_move")
|
||||
{
|
||||
G=data.G;
|
||||
console.log("[CLI] SMART_MOVE");
|
||||
smart.moving=true;
|
||||
smart.plot=[]; smart.flags={}; smart.searching=smart.found=false;
|
||||
character.x=character.real_x=data.start_x;
|
||||
character.y=character.real_y=data.start_y;
|
||||
character.map=data.start_map;
|
||||
smart.x=data.x;
|
||||
smart.y=data.y;
|
||||
smart.map=data.map;
|
||||
start_pathfinding();
|
||||
console.log("[CLI] SMART_MOVE_RESULT: "+smart.found);
|
||||
console.log(smart.plot);
|
||||
worker.postMessage({type:"smart_move",found:smart.found,plot:smart.plot});
|
||||
}
|
||||
else if(data.type=="cm")
|
||||
{
|
||||
var sent=false;
|
||||
characters.forEach(function(char_info){
|
||||
if(char_info.run && char_info.name==data['to'])
|
||||
{
|
||||
char_info.worker.postMessage(data);
|
||||
sent=true;
|
||||
}
|
||||
});
|
||||
if(!sent) console.log("[UNSENT CM] TO: "+data['to']);
|
||||
}
|
||||
else if(data.type=="code_active")
|
||||
{
|
||||
worker.info.code_active=true;
|
||||
worker.postMessage({type:"hello","from":"master.js"});
|
||||
}
|
||||
else if(data.type=="kill") process.exit();
|
||||
});
|
||||
worker.on('error',function(data){
|
||||
console.log("[MASTER] "+worker.info.name+" error: "+data);
|
||||
});
|
||||
worker.on('exit',function(code){
|
||||
if (code !== 0)
|
||||
console.log("[MASTER] "+worker.info.name+" stopped with code: "+code);
|
||||
worker.info.run=false;
|
||||
});
|
||||
return worker;
|
||||
}
|
||||
|
||||
setInterval(function(){
|
||||
|
||||
var current=new Date(),delay=false;
|
||||
|
||||
characters.forEach(function(info){
|
||||
if(info.run && (current-info.last_update)>40000)
|
||||
{
|
||||
console.log("[MASTER] Reloading "+info.name);
|
||||
info.run=false;
|
||||
info.code_active=false;
|
||||
info.worker.terminate();
|
||||
delay=true;
|
||||
}
|
||||
});
|
||||
|
||||
if(delay) return; // worker.on('exit') needs to fire first
|
||||
|
||||
characters.forEach(function(info){
|
||||
if(!info.run)
|
||||
{
|
||||
if(!info.auth) info.auth=auth;
|
||||
info.run=true;
|
||||
info.code_active=false;
|
||||
info.last_update=new Date();
|
||||
delete info.worker;
|
||||
var workerData={}; Object.assign(workerData,info);
|
||||
info.worker=run_character(info);
|
||||
info.worker.info=info;
|
||||
}
|
||||
});
|
||||
|
||||
},100);
|
||||
|
||||
setInterval(function(){
|
||||
if (process.memoryUsage().heapUsed > 300000000) {
|
||||
global.gc();
|
||||
console.log("[MASTER] Manual GC");
|
||||
}
|
||||
},20000);
|
||||
@@ -0,0 +1 @@
|
||||
{"heartbeat":{"GG":"Sun Jun 28 2020 19:58:06 GMT+0300 (GMT+03:00)"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"heartbeat":{"MERC":"Sun Jun 28 2020 19:58:06 GMT+0300 (GMT+03:00)"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"heartbeat":{"MERC":"Wed Jun 17 2020 21:33:13 GMT+0300 (GMT+03:00)"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"heartbeat":{"Wizard":"Sun Jul 12 2020 14:09:42 GMT+0300 (GMT+03:00)"}}
|
||||
@@ -0,0 +1 @@
|
||||
10
|
||||
@@ -0,0 +1 @@
|
||||
{"time":"2020-06-24T18:53:30.947Z","ip":"192.168.1.125","port":"8090"}
|
||||
@@ -0,0 +1,50 @@
|
||||
var jsdom,request,localstorager,localStorage=null;
|
||||
try{
|
||||
jsdom=require("jsdom");
|
||||
}catch(e){
|
||||
console.log("You need to run: npm install jsdom");
|
||||
process.exit();
|
||||
}
|
||||
var { JSDOM }=jsdom;
|
||||
try{
|
||||
request=require('request');
|
||||
}catch(e){
|
||||
console.log("You need to run: npm install request");
|
||||
process.exit();
|
||||
}
|
||||
try{
|
||||
localstorager=require('node-localstorage').LocalStorage;
|
||||
localStorage=new localstorager("./storage");
|
||||
}catch(e){
|
||||
console.log("You need to run: npm install node-localstorage for functioning localStorage support!");
|
||||
}
|
||||
|
||||
localStorage.setItem("gg",10);
|
||||
|
||||
//setInterval(function(){
|
||||
// console.log(localStorage.getItem("gg"));
|
||||
//},3000);
|
||||
|
||||
return;
|
||||
function test1(){ var a=[]; for(var i=0;i<10000;i++) a.push(i); setTimeout(function(){ test1() },1); }
|
||||
|
||||
if(0)
|
||||
{
|
||||
for(var i=0;i<100;i++) test1();
|
||||
}
|
||||
|
||||
if(1)
|
||||
{
|
||||
const jsdom=require("jsdom");
|
||||
const { JSDOM }=jsdom;
|
||||
|
||||
var options={
|
||||
url:"http://gg.com",
|
||||
pretendToBeVisual:true,
|
||||
includeNodeLocations: true,
|
||||
resources:'usable',
|
||||
runScripts:'dangerously',
|
||||
beforeParse:function(window){}
|
||||
}
|
||||
dom=new JSDOM('<script>function test1(){ var t=setTimeout(function(){ test1() },1); }; test1(); </script>',options);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
servers=[
|
||||
["US",2,2,"54.242.16.227"],
|
||||
["EU",2,2,"52.59.255.62"],
|
||||
]
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
// Mappings: config.py + Cloudflare
|
||||
machines={
|
||||
"eud1":{
|
||||
"key":"~/thegame/design/docs/id_rsa.pem",
|
||||
"ip":"195.201.181.245",
|
||||
"user":"root",
|
||||
"map":"eud1",
|
||||
},
|
||||
"usd1":{
|
||||
"key":"~/thegame/design/docs/id_rsa.pem",
|
||||
"ip":"158.69.23.127",
|
||||
"user":"ubuntu",
|
||||
"map":"usd1",
|
||||
},
|
||||
// "eu1":{
|
||||
// "key":"~/thegame/design/docs/id_rsa.pem",
|
||||
// "ip":"35.246.244.105",
|
||||
// "user":"kaan",
|
||||
// "map":"eu1",
|
||||
// },
|
||||
// "eu2":{
|
||||
// "key":"~/thegame/design/docs/id_rsa.pem",
|
||||
// "ip":"35.228.96.241",
|
||||
// "user":"kaan",
|
||||
// "map":"eu2",
|
||||
// },
|
||||
// "eupvp":{
|
||||
// "key":"~/thegame/design/docs/id_rsa.pem",
|
||||
// "ip":"35.234.72.136",
|
||||
// "user":"kaan",
|
||||
// "map":"eupvp",
|
||||
// },
|
||||
// "asia1":{
|
||||
// "key":"~/thegame/design/docs/id_rsa.pem",
|
||||
// "ip":"35.187.255.184",
|
||||
// "user":"kaan",
|
||||
// "map":"asia1",
|
||||
// },
|
||||
// "us1":{
|
||||
// "key":"~/thegame/design/docs/id_rsa.pem",
|
||||
// "ip":"35.184.37.35",
|
||||
// "user":"kaan",
|
||||
// "map":"us1",
|
||||
// },
|
||||
// "us2":{
|
||||
// "key":"~/thegame/design/docs/id_rsa.pem",
|
||||
// "ip":"34.67.188.57",
|
||||
// "user":"kaan",
|
||||
// "map":"us2",
|
||||
// },
|
||||
// "us3":{
|
||||
// "key":"~/thegame/design/docs/id_rsa.pem",
|
||||
// "ip":"34.75.5.124",
|
||||
// "user":"kaan",
|
||||
// "map":"us3",
|
||||
// },
|
||||
// "uspvp":{
|
||||
// "key":"~/thegame/design/docs/id_rsa.pem",
|
||||
// "ip":"34.67.187.11",
|
||||
// "user":"kaan",
|
||||
// "map":"uspvp",
|
||||
// },
|
||||
}
|
||||
// ports: 443, 2053, 2083, 2087, 2096, 8443
|
||||
// https://blog.cloudflare.com/cloudflare-now-supporting-more-ports/
|
||||
servers=[
|
||||
{
|
||||
"region":"EU",
|
||||
"name":"I",
|
||||
"port":2053,
|
||||
"machine":"eud1",
|
||||
},
|
||||
{
|
||||
"region":"EU",
|
||||
"name":"II",
|
||||
"port":2083,
|
||||
"machine":"eud1",
|
||||
},
|
||||
{
|
||||
"region":"EU",
|
||||
"name":"PVP",
|
||||
"port":2087,
|
||||
"machine":"eud1",
|
||||
},
|
||||
// {
|
||||
// "region":"EU",
|
||||
// "name":"DUNGEON",
|
||||
// "port":2053,
|
||||
// "machine":"eupvp",
|
||||
// },
|
||||
{
|
||||
"region":"ASIA",
|
||||
"name":"I",
|
||||
"port":8443,
|
||||
"machine":"eud1",
|
||||
},
|
||||
{
|
||||
"region":"US",
|
||||
"name":"I",
|
||||
"port":2053,
|
||||
"machine":"usd1",
|
||||
},
|
||||
{
|
||||
"region":"US",
|
||||
"name":"II",
|
||||
"port":2083,
|
||||
"machine":"usd1",
|
||||
},
|
||||
{
|
||||
"region":"US",
|
||||
"name":"III",
|
||||
"port":2096,
|
||||
"machine":"usd1",
|
||||
},
|
||||
{
|
||||
"region":"US",
|
||||
"name":"PVP",
|
||||
"port":2087,
|
||||
"machine":"usd1",
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
var io=require('socket.io-client');
|
||||
var num=0;
|
||||
function connect()
|
||||
{
|
||||
// var socket=io('ws://0.0.0.0:8090');
|
||||
var socket=io('ws://138.201.60.196:2053');
|
||||
socket.num=num++;
|
||||
socket.on('connect', function(){console.log("Connected");});
|
||||
socket.on('event', function(data){console.log("Event");});
|
||||
socket.on('disconnect', function(){console.log("Disonnected");});
|
||||
socket.on('connect_error',function(error){
|
||||
console.log("Error: "+error);
|
||||
});
|
||||
socket.on('entities',function(){
|
||||
console.log("Entities on :"+socket.num);
|
||||
});
|
||||
socket.emit("loaded",{success:1,width:1920,height:1080,scale:2});
|
||||
}
|
||||
|
||||
for(var i=0;i<100;i++)
|
||||
{
|
||||
setTimeout(function(){
|
||||
connect();
|
||||
},i*2000)
|
||||
}
|
||||
|
||||
setTimeout(function(){
|
||||
// process.exit();
|
||||
},60000);
|
||||
@@ -0,0 +1,39 @@
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
|
||||
if(!f.in_args("nocheck") && f.read_file("~/thegame/stack/tocheck.txt")) // nocheck doesn't work [23/01/17]
|
||||
{
|
||||
console.log(f.read_file("~/thegame/stack/tocheck.txt"));
|
||||
console.log("Can't Deploy");
|
||||
while(1);
|
||||
}
|
||||
|
||||
f.execs("node ~/thegame/scripts/precompute.js")
|
||||
|
||||
f.execs("rm -rf ~/deploy/thegame_appengine");
|
||||
f.execs("mkdir ~/deploy/thegame_appengine");
|
||||
//f.execs("cp -r ~/thegame/* ~/deploy/thegame_appengine");
|
||||
f.execs("rsync -rv --exclude=.electron ~/thegame/* ~/deploy/thegame_appengine"); // steamworkds_sdk is problematic to cp [11/02/19]
|
||||
|
||||
f.execs("rm -rf ~/deploy/thegame_appengine/node");
|
||||
f.execs("rm -rf ~/deploy/thegame_appengine/scripts");
|
||||
f.execs("cp ~/deploy/thegame_appengine/stack/update_notes.txt ~/deploy/thegame_appengine/design/update_notes.txt");
|
||||
f.execs("rm -rf ~/deploy/thegame_appengine/stack");
|
||||
f.execs("mkdir ~/deploy/thegame_appengine/stack");
|
||||
f.execs("cp ~/deploy/thegame_appengine/design/update_notes.txt ~/deploy/thegame_appengine/stack/update_notes.txt");
|
||||
f.execs("rm -rf ~/deploy/thegame_appengine/origin");
|
||||
f.execs("rm -rf ~/deploy/thegame_appengine/electron");
|
||||
f.execs("find ~/deploy/thegame_appengine/ -name '*.pxm' -delete");
|
||||
|
||||
f.execs("cp ~/deploy/thegame_appengine/js/runner_functions.js ~/deploy/thegame_appengine/htmls/contents/codes/runner_functions.js");
|
||||
f.execs("cp ~/deploy/thegame_appengine/js/runner_compat.js ~/deploy/thegame_appengine/htmls/contents/codes/runner_compat.js");
|
||||
f.execs("cp ~/deploy/thegame_appengine/js/common_functions.js ~/deploy/thegame_appengine/htmls/contents/codes/common_functions.js");
|
||||
|
||||
f.write_file("~/deploy/thegame_appengine/app.yaml",f.read_file("~/thegame/app.yaml").replace("application:","#application:").replace("version:","#version:"));
|
||||
|
||||
to_minify={
|
||||
// "js":["game.js","keyboard.js","html.js","functions.js","common_functions.js"],
|
||||
"css":["index.css","common.css"],
|
||||
"utility/htmls":["map_editor.js"],
|
||||
};
|
||||
|
||||
f.minify_all("~/deploy/thegame_appengine",to_minify);
|
||||
@@ -0,0 +1,39 @@
|
||||
var image_size=require('image-size'),fs=require('fs');
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
var images={};
|
||||
|
||||
f.execs("rm -rf ~/thegame/electron/files");
|
||||
f.execs("mkdir ~/thegame/electron/files");
|
||||
[["~/thegame/design/sprites.py",".png"],["~/thegame/design/animations.py",".png"],["~/thegame/js/functions.js",".ogg"],["~/thegame/js/functions.js",".wav"]].forEach(function(fext){
|
||||
var main=fext[0],ext=fext[1];
|
||||
var data=f.read_file(main);
|
||||
data=data.split(ext);
|
||||
for(var i=0;i<data.length-1;i++)
|
||||
{
|
||||
var file=data[i];
|
||||
file=file.split('"');
|
||||
file=file[file.length-1];
|
||||
file=file+ext;
|
||||
if(ext==".png") images[file]=image_size(process.env.HOME+'/thegame'+file);
|
||||
else images[file]={};
|
||||
|
||||
var version=data[i+1];
|
||||
version=version.split("?v=")[1];
|
||||
if(version) version=version.split('"')[0];
|
||||
if(version) images[file].v=version;
|
||||
|
||||
var folder=file.split("/");
|
||||
folder.length=folder.length-1;
|
||||
if(folder.length)
|
||||
{
|
||||
folder=folder.join("/");
|
||||
f.execs("mkdir -p ~/thegame/electron/files"+folder);
|
||||
}
|
||||
|
||||
f.execs("cp ~/thegame"+file+" ~/thegame/electron/files"+file);
|
||||
}
|
||||
});
|
||||
|
||||
// console.log(images);
|
||||
|
||||
f.write_file("~/thegame/electron/manifest.js","// "+(new Date())+"\nmodule.exports="+JSON.stringify(images)+"\n");
|
||||
@@ -0,0 +1,29 @@
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
require(process.env.HOME+"/thegame/scripts/data.js");
|
||||
|
||||
setInterval(function(){
|
||||
for(var id in machines)
|
||||
{
|
||||
try{
|
||||
var machine=machines[id];
|
||||
var command="ssh -i "+machine.key+" "+machine.user+"@"+machine.ip+" \"ps aux | grep node\"";
|
||||
var output=f.execs(command);
|
||||
if(output.indexOf("root")==-1) return;
|
||||
servers.forEach(function(server){
|
||||
if(server.machine!=id) return;
|
||||
var name=server.region+" "+server.name+" "+server.port;
|
||||
if(output.indexOf("node server/server.js "+server.region+" "+server.name+" "+server.port)==-1)
|
||||
{
|
||||
console.log("Server not running: "+name);
|
||||
var command="ssh -i "+machine.key+" "+machine.user+"@"+machine.ip+" \"nohup node server/server.js "+server.region+" "+server.name+" "+server.port+" > s"+server.port+".out 2> s"+server.port+".err < /dev/null &\"";
|
||||
console.log(command);
|
||||
f.execso(command);
|
||||
}
|
||||
else
|
||||
{
|
||||
//console.log("Server running: "+name);
|
||||
}
|
||||
});
|
||||
}catch(e){}
|
||||
}
|
||||
},10000);
|
||||
@@ -0,0 +1,12 @@
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
require(process.env.HOME+"/thegame/scripts/data.js");
|
||||
|
||||
servers.forEach(function(server){
|
||||
var machine=machines[server.machine];
|
||||
var command="["+server.machine+"] ssh -i "+machine.key+" "+machine.user+"@"+machine.ip;
|
||||
console.log(command);
|
||||
command="["+server.machine+" logs] scp -i "+machine.key+" "+machine.user+"@"+machine.ip+":s"+server.port+".out .";
|
||||
console.log(command);
|
||||
command="["+server.machine+" run] ssh -i "+machine.key+" "+machine.user+"@"+machine.ip+" \"nohup node server/server.js "+server.region+" "+server.name+" "+server.port+" > s"+server.port+".out 2> s"+server.port+".err < /dev/null &\"";
|
||||
console.log(command);
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
require(process.env.HOME+"/thegame/scripts/data.js");
|
||||
|
||||
for(var id in machines)
|
||||
{
|
||||
var machine=machines[id];
|
||||
var command="ssh -i "+machine.key+" "+machine.user+"@"+machine.ip+" \"ps aux | grep node\"";
|
||||
console.log(command);
|
||||
f.execso(command);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "adventureland-scripts",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "list_commands.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node list_commands.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "AdventureLandOnlyUse",
|
||||
"dependencies": {
|
||||
"image-size": "^0.8.3",
|
||||
"ip": "^1.1.5",
|
||||
"node-fetch": "^2.6.1",
|
||||
"node-minify": "^3.6.0",
|
||||
"prompt": "^1.1.0",
|
||||
"request": "^2.88.2",
|
||||
"sync-exec": "^0.6.2",
|
||||
"xml2js": "^0.4.23"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
var image_size=require('image-size'),fs=require('fs');
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
var images={};
|
||||
|
||||
var data=f.read_file("~/thegame/design/sprites.py");
|
||||
data=data.split(".png");
|
||||
delete data[data.length-1];
|
||||
data.forEach(function(file){
|
||||
file=file.split('"');
|
||||
file=file[file.length-1];
|
||||
file=file+".png";
|
||||
images[file]=image_size(process.env.HOME+'/thegame'+file);
|
||||
})
|
||||
|
||||
// console.log(images);
|
||||
|
||||
f.write_file("~/thegame/design/precomputed.py","# "+(new Date())+"\nimages="+JSON.stringify(images)+"\n");
|
||||
@@ -0,0 +1,8 @@
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
f.execs("rm -rf ~/deploy/server");
|
||||
f.execs("mkdir ~/deploy/server");
|
||||
f.execs("cp -r ~/thegame/node/* ~/deploy/server");
|
||||
f.execs("rm -rf ~/deploy/server/node_modules");
|
||||
f.execs("rm ~/deploy/server/variables.js");
|
||||
f.execs("mv ~/deploy/server/live_variables.js ~/deploy/server/variables.js");
|
||||
f.execs("cp ~/thegame/js/common_functions.js ~/deploy/server");
|
||||
@@ -0,0 +1,22 @@
|
||||
var image_size=require('image-size'),fs=require('fs');
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
var images=[];
|
||||
|
||||
[["/images/tiles/monsters/","monsters",".png"],["/images/tiles/characters/","characters",".png"],["/images/tiles/characters/tribes/","tribes",".png"],["/images/tiles/characters/npcs/","npcs",".png"],["/images/tiles/map/","map",".png"],["/images/tiles/examples/","examples",".png"],["/images/tiles/examples/","examples_gif",".gif"],["/images/sprites/animations/","animations",".png"],["/images/sprites/emblems/","emblems",".png"],["/images/sprites/weather/","weather",".png"],["/images/tiles/animations/","new animations",".png"]].forEach(function(fext){
|
||||
var folder=fext[0],tag=fext[1],ext=fext[2];
|
||||
var current=[];
|
||||
f.ch("~/thegame"+folder);
|
||||
var data=f.execs("ls -al");
|
||||
data=data.split(ext);
|
||||
for(var i=0;i<data.length-1;i++)
|
||||
{
|
||||
var file=data[i];
|
||||
file=file.split(' ');
|
||||
file=file[file.length-1];
|
||||
file=folder+file+ext;
|
||||
current.push(file);
|
||||
}
|
||||
images.push([tag,current]);
|
||||
});
|
||||
|
||||
f.write_file("~/thegame/utility/gallery.py","# "+(new Date())+"\ngallery="+JSON.stringify(images)+"\n");
|
||||
@@ -0,0 +1,35 @@
|
||||
// var sharp=require('sharp');
|
||||
|
||||
// sharp(process.env.HOME+'/thegame/scripts/tileB_desert.png')
|
||||
// .resize(384,384,{kernel:sharp.kernel.cubic,interpolator:sharp.interpolator.bilinear}) //kernel:"cubic", interpolator:"nearest",
|
||||
// .toFile(process.env.HOME+'/thegame/scripts/tileB_desert2.png', function(err) {
|
||||
// // output.jpg is a 300 pixels wide and 200 pixels high image
|
||||
// // containing a scaled and cropped version of input.jpg
|
||||
// });
|
||||
// doesn't work, loses quality
|
||||
|
||||
|
||||
var fs = require('fs'),
|
||||
PNG = require('pngjs').PNG;
|
||||
|
||||
fs.createReadStream('vampire.png')
|
||||
.pipe(new PNG({
|
||||
filterType: 4
|
||||
}))
|
||||
.on('parsed', function() {
|
||||
|
||||
var output=new PNG({width:this.width/2,height:this.height/2,filterType:4})
|
||||
|
||||
for (var y = 0; y < this.height/2; y++) {
|
||||
for (var x = 0; x < this.width/2; x++) {
|
||||
var idx = (output.width * y + x) << 2;
|
||||
var idx2 = (this.width * 2*y + 2*x) << 2;
|
||||
output.data[idx]=this.data[idx2];
|
||||
output.data[idx+1]=this.data[idx2+1];
|
||||
output.data[idx+2]=this.data[idx2+2];
|
||||
output.data[idx+3]=this.data[idx2+3];
|
||||
}
|
||||
}
|
||||
|
||||
output.pack().pipe(fs.createWriteStream('vampire2.png'));
|
||||
});
|
||||
@@ -0,0 +1,18 @@
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
require(process.env.HOME+"/thegame/scripts/data.js");
|
||||
|
||||
for(var id in machines)
|
||||
{
|
||||
var machine=machines[id];
|
||||
var single_command="npm install socket.io@2.1.1";
|
||||
var single_command="sudo apt-get update";
|
||||
var single_command="sudo apt-get -y upgrade";
|
||||
var single_command="sudo shutdown";
|
||||
var single_command="sudo n latest";
|
||||
var single_command="sudo killall -s KILL node";
|
||||
var single_command="ps aux | grep -i node | awk '{print $2}' | xargs kill -9";
|
||||
// var single_command="npm install socket.io@2.1.1";
|
||||
var command="ssh -i "+machine.key+" "+machine.user+"@"+machine.ip+" \""+single_command+"\"";
|
||||
console.log(command);
|
||||
f.execso(command);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
require(process.env.HOME+"/thegame/scripts/data.js");
|
||||
|
||||
servers.forEach(function(server){
|
||||
var machine=machines[server.machine];
|
||||
var command="ssh -i "+machine.key+" "+machine.user+"@"+machine.ip+" \"nohup node server/server.js "+server.region+" "+server.name+" "+server.port+" > s"+server.port+".out 2> s"+server.port+".err < /dev/null &\"";
|
||||
console.log(command);
|
||||
f.execso(command);
|
||||
});
|
||||
@@ -0,0 +1,37 @@
|
||||
var secret="ac2b8964dffd4a8a961f427d1257d8f7";
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
var iap = require('in-app-purchase');
|
||||
var receipt_file="/Applications/Adventure Land.app/Contents/_MASReceipt/receipt";
|
||||
//var receipt_file="/Users/kaan/Downloads/receipt";
|
||||
var receipt_file="/Users/kaan/Downloads/receipt2";
|
||||
iap.config({
|
||||
appleExcludeOldTransactions: false,
|
||||
applePassword:secret,
|
||||
});
|
||||
// console.log(f.read_file(receipt_file));
|
||||
// console.log(require("fs").readFileSync(receipt_file));
|
||||
console.log(require("fs").readFileSync(receipt_file).toString("base64"));
|
||||
iap.setup().then(() => {
|
||||
// iap.validate(...) automatically detects what type of receipt you are trying to validate
|
||||
iap.validate(require("fs").readFileSync(receipt_file).toString("base64")).then(onSuccess).catch(onError);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("error");
|
||||
});
|
||||
|
||||
function onSuccess(validatedData) {
|
||||
// validatedData: the actual content of the validated receipt
|
||||
// validatedData also contains the original receipt
|
||||
var options = {
|
||||
ignoreCanceled: true, // Apple ONLY (for now...): purchaseData will NOT contain cancceled items
|
||||
ignoreExpired: true // purchaseData will NOT contain exipired subscription items
|
||||
};
|
||||
// validatedData contains sandbox: true/false for Apple and Amazon
|
||||
console.log("Validated: "+JSON.stringify(validatedData));
|
||||
var purchaseData = iap.getPurchaseData(validatedData, options);
|
||||
console.log("purchaseData: "+JSON.stringify(purchaseData));
|
||||
}
|
||||
|
||||
function onError(error) {
|
||||
console.log("Error: "+JSON.stringify(error));
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
const jsdom=require("jsdom");
|
||||
const { JSDOM }=jsdom;
|
||||
const request=require('request');
|
||||
|
||||
var base_url="http://thegame.com";
|
||||
var auth="5818821692620800-gjxqztPovvpiaKTGnjEtT";
|
||||
var characters=[["Fun","MOVETEST"],["Wizard",1]];
|
||||
var doms=[],num=0;
|
||||
|
||||
characters.forEach(function(def){
|
||||
|
||||
var character=def[0],code=def[1];
|
||||
var url=base_url+"/character/"+character+"/in/EU/I/?no_html=bot&&code="+code+"&&auth="+auth;
|
||||
|
||||
request(url, (error, response, body) => {
|
||||
|
||||
var virtualConsole=new jsdom.VirtualConsole();
|
||||
virtualConsole.sendTo(console);
|
||||
|
||||
var options={
|
||||
url:url,
|
||||
pretendToBeVisual:true,
|
||||
resources:'usable',
|
||||
runScripts:'dangerously',
|
||||
virtualConsole:virtualConsole,
|
||||
beforeParse:function(window){}
|
||||
}
|
||||
var dom=new JSDOM(body,options);
|
||||
dom.name=num++;
|
||||
doms.push(dom);
|
||||
//console.log(dom.window.document.body.innerHTML);
|
||||
});
|
||||
// #TODO: Reload on disconnects
|
||||
});
|
||||
|
||||
setInterval(function(){
|
||||
doms.forEach(function(dom){
|
||||
if(!dom.window.game_logs) return;
|
||||
if(dom.window.character) dom.name=dom.window.character.name;
|
||||
dom.window.game_logs.forEach(function(l){
|
||||
console.log(dom.name+"[LOG] "+l[0]);
|
||||
});
|
||||
dom.window.game_logs=[];
|
||||
dom.window.game_chats.forEach(function(c){
|
||||
console.log(dom.name+"[CHAT] "+c[0]+": "+c[1]);
|
||||
});
|
||||
dom.window.game_chats=[];
|
||||
});
|
||||
},10);
|
||||
@@ -0,0 +1,21 @@
|
||||
const jsdom=require("jsdom");
|
||||
const { JSDOM }=jsdom;
|
||||
const virtualConsole=new jsdom.VirtualConsole();
|
||||
|
||||
const url="http://thegame.com/character/Fun/in/EU/I/?no_html=1&&code=MOVETEST&&auth="+"5818821692620800-gjxqztPovvpiaKTGnjEtT";
|
||||
const options={
|
||||
url:url,
|
||||
pretendToBeVisual:true,
|
||||
resources:'usable',
|
||||
runScripts:'dangerously',
|
||||
virtualConsole
|
||||
}
|
||||
dom=JSDOM.fromURL(url,options);
|
||||
|
||||
virtualConsole.on("error", (...args) => { console.log(args); });
|
||||
virtualConsole.on("warn", (...args) => { console.log(args); });
|
||||
virtualConsole.on("info", (...args) => { console.log(args); });
|
||||
virtualConsole.on("dir", (...args) => { console.log(args); });
|
||||
|
||||
setInterval(function(){
|
||||
},1);
|
||||
@@ -0,0 +1,18 @@
|
||||
var f=require(process.env.HOME+"/thegeobird/scripts/functions.js");
|
||||
require(process.env.HOME+"/thegame/scripts/data.js");
|
||||
|
||||
f.execso("node ~/gscripts/prepare_server.js;");
|
||||
console.log("\nPrepared the server");
|
||||
|
||||
for(var id in machines)
|
||||
{
|
||||
var machine=machines[id];
|
||||
// var command="scp -qv -r -i "+machine.key+" ~/deploy/server "+machine.user+"@"+machine.ip+":./ 2>&1 | grep -e 'Sending file modes' -e 'Exit status'";
|
||||
var command="rsync -ru --exclude='node_modules/' ~/deploy/server -i "+machine.key+" "+machine.user+"@"+machine.ip+":./";
|
||||
//var command="rsync -ru ~/deploy/server -e \"ssh -i "+machine.key+"\" "+machine.user+"@"+machine.ip+":./";
|
||||
// Spent 50 minutes on perfecting the scp output, bastards didn't provide a non-interactive output argument ... [05/08/18]
|
||||
// command+=" > /tmp/scp.log 2>&1";
|
||||
console.log("\nRunning: "+command);
|
||||
f.execso(command);
|
||||
//f.execso("cat /tmp/scp.log");
|
||||
}
|
||||
Reference in New Issue
Block a user