Commit b8fa792d authored by nanahira's avatar nanahira

Merge branch 'mc'

parents 607dec73 6ab4630a
......@@ -194,7 +194,8 @@
"arena_wait_timeout": "Your opponent did not appear, you may quit without any penalty.",
"auto_death_part1": "This room is an auto-extra-duel room. The Extra Duel will begin after ",
"auto_death_part2": " minutes.",
"athletic_arena_tip": "During an athletic match, a game quit behavior is regarded as a surrender."
"athletic_arena_tip": "During an athletic match, a game quit behavior is regarded as a surrender.",
"windbot_disable_random_room": "By adding the AI, this random game won't get any new player unless they enter the room name:"
},
"es-es": {
"random_duel_enter_room_waiting": "Tu oponente esta listo, Iniciar!",
......@@ -535,7 +536,8 @@
"arena_wait_timeout": "由于对手未能在30秒内进入游戏,此时您退出游戏不会扣分。",
"auto_death_part1": "本房间为自动加时赛房间。比赛开始",
"auto_death_part2": "分钟后,将自动进入加时赛。",
"athletic_arena_tip": "在竞技匹配中,比赛开始前退出游戏也会视为投降。"
"athletic_arena_tip": "在竞技匹配中,比赛开始前退出游戏也会视为投降。",
"windbot_disable_random_room": "因为添加了AI,本随机对战房间将只能通过房间名加入:"
},
"ko-kr": {
"random_duel_enter_room_waiting": "땅콩: 게임을 진행하게 준비 또는 시작을 하십시오.",
......
......@@ -27,7 +27,7 @@ or as follows, to use a specific set of permissions.
fs = require 'fs'
loadJSON = require('load-json-file').sync
moment = require 'moment'
moment.locale('zh-cn', {
moment.updateLocale('zh-cn', {
relativeTime: {
future: '%s内',
past: '%s前',
......@@ -45,13 +45,16 @@ moment.locale('zh-cn', {
}
})
bunyan = require 'bunyan'
log = bunyan.createLogger name: "auth"
if not fs.existsSync('./logs')
fs.mkdirSync('./logs')
add_log = (message) ->
mt = moment()
log.info(message)
text = mt.format('YYYY-MM-DD HH:mm:ss') + " --> " + message + "\n"
console.log(text)
res = false
try
fs.appendFileSync("./logs/"+mt.format('YYYY-MM-DD')+".log", text)
......
......@@ -28,7 +28,7 @@ or as follows, to use a specific set of permissions.
*/
(function() {
var add_log, check_permission, default_data, fs, loadJSON, moment, reload, save, setting_save, users;
var add_log, bunyan, check_permission, default_data, fs, loadJSON, log, moment, reload, save, setting_save, users;
fs = require('fs');
......@@ -36,7 +36,7 @@ or as follows, to use a specific set of permissions.
moment = require('moment');
moment.locale('zh-cn', {
moment.updateLocale('zh-cn', {
relativeTime: {
future: '%s内',
past: '%s前',
......@@ -54,6 +54,12 @@ or as follows, to use a specific set of permissions.
}
});
bunyan = require('bunyan');
log = bunyan.createLogger({
name: "auth"
});
if (!fs.existsSync('./logs')) {
fs.mkdirSync('./logs');
}
......@@ -61,8 +67,8 @@ or as follows, to use a specific set of permissions.
add_log = function(message) {
var mt, res, text;
mt = moment();
log.info(message);
text = mt.format('YYYY-MM-DD HH:mm:ss') + " --> " + message + "\n";
console.log(text);
res = false;
try {
fs.appendFileSync("./logs/" + mt.format('YYYY-MM-DD') + ".log", text);
......
......@@ -22,7 +22,7 @@ bunyan = require 'bunyan'
log = bunyan.createLogger name: "mycard"
moment = require 'moment'
moment.locale('zh-cn', {
moment.updateLocale('zh-cn', {
relativeTime: {
future: '%s内',
past: '%s前',
......@@ -672,7 +672,7 @@ ROOM_find_or_create_random = (type, player_ip)->
max_player = if type == 'T' then 4 else 2
playerbanned = (bannedplayer and bannedplayer.count > 3 and moment() < bannedplayer.time)
result = _.find ROOM_all, (room)->
return room and room.random_type != '' and !room.started and
return room and room.random_type != '' and !room.started and !room.windbot and
((type == '' and (room.random_type == 'S' or (settings.modules.random_duel.blank_pass_match and room.random_type != 'T'))) or room.random_type == type) and
room.get_playing_player().length < max_player and
(settings.modules.random_duel.no_rematch_check or room.get_host() == null or
......@@ -3225,6 +3225,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
return
else
windbot = _.sample windbots
if room.random_type
ygopro.stoc_send_chat(client, "${windbot_disable_random_room} " + room.name, ygopro.constants.COLORS.BABYBLUE)
room.add_windbot(windbot)
when '/roomname'
......@@ -4023,7 +4025,7 @@ if settings.modules.http
return
else
getpath=u.pathname.split("/")
filename=decodeURIComponent(getpath.pop())
filename=path.basename(decodeURIComponent(getpath.pop()))
fs.readFile(settings.modules.tournament_mode.replay_path + filename, (error, buffer)->
if error
response.writeHead(404)
......
......@@ -40,7 +40,7 @@
moment = require('moment');
moment.locale('zh-cn', {
moment.updateLocale('zh-cn', {
relativeTime: {
future: '%s内',
past: '%s前',
......@@ -865,7 +865,7 @@
max_player = type === 'T' ? 4 : 2;
playerbanned = bannedplayer && bannedplayer.count > 3 && moment() < bannedplayer.time;
result = _.find(ROOM_all, function(room) {
return room && room.random_type !== '' && !room.started && ((type === '' && (room.random_type === 'S' || (settings.modules.random_duel.blank_pass_match && room.random_type !== 'T'))) || room.random_type === type) && room.get_playing_player().length < max_player && (settings.modules.random_duel.no_rematch_check || room.get_host() === null || room.get_host().ip !== ROOM_players_oppentlist[player_ip]) && (playerbanned === room.deprecated || type === 'T');
return room && room.random_type !== '' && !room.started && !room.windbot && ((type === '' && (room.random_type === 'S' || (settings.modules.random_duel.blank_pass_match && room.random_type !== 'T'))) || room.random_type === type) && room.get_playing_player().length < max_player && (settings.modules.random_duel.no_rematch_check || room.get_host() === null || room.get_host().ip !== ROOM_players_oppentlist[player_ip]) && (playerbanned === room.deprecated || type === 'T');
});
if (result) {
result.welcome = '${random_duel_enter_room_waiting}';
......@@ -4151,6 +4151,9 @@
} else {
windbot = _.sample(windbots);
}
if (room.random_type) {
ygopro.stoc_send_chat(client, "${windbot_disable_random_room} " + room.name, ygopro.constants.COLORS.BABYBLUE);
}
room.add_windbot(windbot);
}
break;
......@@ -5238,7 +5241,7 @@
return;
} else {
getpath = u.pathname.split("/");
filename = decodeURIComponent(getpath.pop());
filename = path.basename(decodeURIComponent(getpath.pop()));
fs.readFile(settings.modules.tournament_mode.replay_path + filename, function(error, buffer) {
if (error) {
response.writeHead(404);
......
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