Commit 9d553918 authored by mercury233's avatar mercury233

fix & add ai log

parent c78c65d7
......@@ -322,9 +322,9 @@ class Room
player.pre_establish_buffers = []
return
return
console.log @windbot
if @windbot
spawn 'mono', ['WindBot.exe'], {
log.info @windbot
@ai_process = spawn 'mono', ['WindBot.exe'], {
cwd: 'windbot', env: {
YGOPRO_VERSION: settings.version
YGOPRO_HOST: '127.0.0.1'
......@@ -334,6 +334,12 @@ class Room
YGOPRO_DIALOG: @windbot.dialog
}
}
@ai_process.stdout.on 'data', (data)=>
log.info "AI stdout: " + data
return
@ai_process.stderr.on 'data', (data)=>
log.info "AI stderr: " + data
return
return
catch
@error = "建立房间失败,请重试"
......
......@@ -420,9 +420,9 @@
player.pre_establish_buffers = [];
});
});
console.log(_this.windbot);
if (_this.windbot) {
spawn('mono', ['WindBot.exe'], {
log.info(_this.windbot);
_this.ai_process = spawn('mono', ['WindBot.exe'], {
cwd: 'windbot',
env: {
YGOPRO_VERSION: settings.version,
......@@ -433,6 +433,12 @@
YGOPRO_DIALOG: _this.windbot.dialog
}
});
_this.ai_process.stdout.on('data', function(data) {
log.info("AI stdout: " + data);
});
_this.ai_process.stderr.on('data', function(data) {
log.info("AI stderr: " + data);
});
}
};
})(this));
......
......@@ -31,6 +31,8 @@ settings.BANNED_IP = []
settings.modules.hang_timeout = 90
settings.version = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\d]+)/)[1], '16')
settings.lflist = (for list in fs.readFileSync('ygopro/lflist.conf', 'utf8').match(/!.*/g)
date=list.match(/!([\d\.]+)/)
continue unless date
{date: moment(list.match(/!([\d\.]+)/)[1], 'YYYY.MM.DD'), tcg: list.indexOf('TCG') != -1})
#组件
......@@ -339,7 +341,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
else
windbot = _.sample settings.modules.windbot
room = Room.find_or_create_by_name('AI#' + Math.random().toString()) # 这个 AI# 没有特殊作用, 仅作为标记
room = Room.find_or_create_by_name('AI#' + Math.floor(Math.random() * 100000)) # 这个 AI# 没有特殊作用, 仅作为标记
room.windbot = windbot
room.private = true
client.room = room
......
// Generated by CoffeeScript 1.10.0
(function() {
var Graveyard, Room, _, bunyan, crypto, debug, dialogues, execFile, fs, http, http_server, https, https_server, list, log, moment, net, options, os, path, pg, request, requestListener, roomlist, settings, tips, tribute, url, users_cache, wait_room_start, ygopro;
var Graveyard, Room, _, bunyan, crypto, date, debug, dialogues, execFile, fs, http, http_server, https, https_server, list, log, moment, net, options, os, path, pg, request, requestListener, roomlist, settings, tips, tribute, url, users_cache, wait_room_start, ygopro;
net = require('net');
......@@ -46,6 +46,10 @@
results = [];
for (k = 0, len = ref.length; k < len; k++) {
list = ref[k];
date = list.match(/!([\d\.]+)/);
if (!date) {
continue;
}
results.push({
date: moment(list.match(/!([\d\.]+)/)[1], 'YYYY.MM.DD'),
tcg: list.indexOf('TCG') !== -1
......@@ -382,7 +386,7 @@
} else {
windbot = _.sample(settings.modules.windbot);
}
room = Room.find_or_create_by_name('AI#' + Math.random().toString());
room = Room.find_or_create_by_name('AI#' + Math.floor(Math.random() * 100000));
room.windbot = windbot;
room["private"] = true;
client.room = room;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment