Commit cf10fd63 authored by mercury233's avatar mercury233

update

parent cec959a8
{ {
"en-us": { "en-us": {
"kicked_by_system": " been removed from the game.", "kicked_by_system": "been removed from the game.",
"random_duel_enter_room_waiting": "Your opponent is already waiting for you, start now!", "random_duel_enter_room_waiting": "Your opponent is already waiting for you, start now!",
"random_duel_enter_room_new": "Game created, waiting for random opponent.", "random_duel_enter_room_new": "Game created, waiting for random opponent.",
"random_duel_enter_room_match": "Match mode, better use competitive decks!", "random_duel_enter_room_match": "Match mode, better use competitive decks!",
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"add_windbot_failed": "Failed to add an AI, you may want to enter /ai again.", "add_windbot_failed": "Failed to add an AI, you may want to enter /ai again.",
"quit_spectate": "left as spectator", "quit_spectate": "left as spectator",
"flee": "fled", "flee": "fled",
"leave_game": "left the game", "left_game": "left the game",
"server_closed": "the game was ended by the server", "server_closed": "the game was ended by the server",
"server_error": "server error:", "server_error": "server error:",
"cloud_replay_no": "replay not found", "cloud_replay_no": "replay not found",
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
"spectate_join": "joined as spectator.", "spectate_join": "joined as spectator.",
"spectate_present": "is spectating.", "spectate_present": "is spectating.",
"spectate_denied": "The duel had begun, spectation is not allowed", "spectate_denied": "The duel had begun, spectation is not allowed",
"rank_arena": "Your ranking is", "rank_arena": ", Your ranking is",
"rank_blank": "You are not ranked", "rank_blank": ", You are not ranked",
"exp_value_part1": "You have", "exp_value_part1": "You have",
"exp_value_part2": "exp", "exp_value_part2": "exp",
"exp_value_part3": ",your power level is", "exp_value_part3": ",your power level is",
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
"chat_order_roomname": "/roomname show room name", "chat_order_roomname": "/roomname show room name",
"chat_order_windbot": "/ai to add an AI,/ai name to add selected AI ", "chat_order_windbot": "/ai to add an AI,/ai name to add selected AI ",
"chat_order_tip": "/tip show a tip", "chat_order_tip": "/tip show a tip",
"room_name": "The name of the room is ", "room_name": "The name of the room is",
"banned_chat_level1": "You are being banned from chatting.", "banned_chat_level1": "You are being banned from chatting.",
"banned_chat_level2": "You are being banned from the matching system for sending inappropriate messages.", "banned_chat_level2": "You are being banned from the matching system for sending inappropriate messages.",
"chat_warn_level1": "WARNING: This message is inappropriate.", "chat_warn_level1": "WARNING: This message is inappropriate.",
...@@ -78,13 +78,13 @@ ...@@ -78,13 +78,13 @@
"cloud_replay_delay_part2": ". It can be accessed after this match.", "cloud_replay_delay_part2": ". It can be accessed after this match.",
"no_action": "no action detected", "no_action": "no action detected",
"no_action_kick": "removed by the system", "no_action_kick": "removed by the system",
"no action_warn_part1": "No action detected, you will be removed in ", "no_action_warn_part1": "No action detected, you will be removed in ",
"no action_warn_part2": " seconds", "no_action_warn_part2": " seconds",
"incorrect_password": "incorrect password", "incorrect_password": "incorrect password",
"file_not_found": "file not found " "file_not_found": "file not found "
}, },
"zh-cn": { "zh-cn": {
"kicked_by_system": " 被系统请出了房间", "kicked_by_system": "被系统请出了房间",
"random_duel_enter_room_waiting": "对手已经在等你了,开始决斗吧!", "random_duel_enter_room_waiting": "对手已经在等你了,开始决斗吧!",
"random_duel_enter_room_new": "已建立随机对战房间,正在等待对手!", "random_duel_enter_room_new": "已建立随机对战房间,正在等待对手!",
"random_duel_enter_room_match": "您进入了比赛模式的房间,我们推荐使用竞技卡组!", "random_duel_enter_room_match": "您进入了比赛模式的房间,我们推荐使用竞技卡组!",
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
"cloud_replay_playing": "正在观看云录像", "cloud_replay_playing": "正在观看云录像",
"cloud_replay_hint": "以下是您近期的云录像,密码处输入 R#录像编号 即可观看", "cloud_replay_hint": "以下是您近期的云录像,密码处输入 R#录像编号 即可观看",
"blank_room_name": "房间名不能为空,请在主机密码处填写房间名", "blank_room_name": "房间名不能为空,请在主机密码处填写房间名",
"loading_user_info": "正在读取用户信息", "loading_user_info": "正在读取用户信息...",
"invalid_password_length": "主机密码不正确 (Invalid Length)", "invalid_password_length": "主机密码不正确 (Invalid Length)",
"invalid_password_payload": "主机密码不正确 (Invalid Payload Length)", "invalid_password_payload": "主机密码不正确 (Invalid Payload Length)",
"invalid_password_unauthorized": "主机密码不正确 (Unauthorized)", "invalid_password_unauthorized": "主机密码不正确 (Unauthorized)",
...@@ -128,23 +128,23 @@ ...@@ -128,23 +128,23 @@
"watch_join": "加入了观战", "watch_join": "加入了观战",
"watch_present": "观战中", "watch_present": "观战中",
"watch_denied": "决斗已开始,不允许观战", "watch_denied": "决斗已开始,不允许观战",
"rank_arena": "排名第", "rank_arena": "排名第",
"rank_blank": "暂无排名", "rank_blank": "暂无排名",
"exp_value_part1": "你有", "exp_value_part1": "你有",
"exp_value_part2": "点经验", "exp_value_part2": "点经验",
"exp_value_part3": ",你的战斗力是", "exp_value_part3": ",你的战斗力是",
"exp_value_part4": "。正式上线前这些积分可能重置", "exp_value_part4": "。正式上线前这些积分可能重置",
"lp_low_level1": "你的生命已经如风中残烛了!", "lp_low_level1": "你的生命已经如风中残烛了!",
"lp_low_level2": "背水一战!", "lp_low_level2": "背水一战!",
"zombie_player": "挂房间", "zombie_player": "挂房间",
"kicked_by_player": "被请出了房间", "kicked_by_player": "被请出了房间",
"kicked_by_system_count_down": "秒后房主若不开始游戏将被请出房", "kicked_by_system_count_down": "秒后房主若不开始游戏将被请出房",
"chat_order_main": "Mycard YGOPro Server 指令帮助", "chat_order_main": "Mycard YGOPro Server 指令帮助",
"chat_order_help": "/help 显示这个帮助信息", "chat_order_help": "/help 显示这个帮助信息",
"chat_order_roomname": "/roomname 显示当前房间的名字", "chat_order_roomname": "/roomname 显示当前房间的名字",
"chat_order_windbot": "/ai 添加一个AI,/ai 角色名 可指定添加的角色", "chat_order_windbot": "/ai 添加一个AI,/ai 角色名 可指定添加的角色",
"chat_order_tip": "/tip 显示一条提示", "chat_order_tip": "/tip 显示一条提示",
"room_name": "您当前的房间名是 ", "room_name": "您当前的房间名是",
"banned_chat_level1": "您已被禁言!", "banned_chat_level1": "您已被禁言!",
"banned_chat_level2": "您的发言存在严重不适当的内容,禁止您使用随机对战功能!", "banned_chat_level2": "您的发言存在严重不适当的内容,禁止您使用随机对战功能!",
"chat_warn_level1" : "发言违规", "chat_warn_level1" : "发言违规",
...@@ -162,8 +162,8 @@ ...@@ -162,8 +162,8 @@
"cloud_replay_delay_part2": "。将于本局结束后可播放。", "cloud_replay_delay_part2": "。将于本局结束后可播放。",
"no_action": "挂机", "no_action": "挂机",
"no_action_kick": "被系统请出了房间", "no_action_kick": "被系统请出了房间",
"no action_warn_part1": "已经很久没有操作了,若继续挂机,将于", "no_action_warn_part1": "已经很久没有操作了,若继续挂机,将于",
"no action_warn_part2": "秒后被请出房间", "no_action_warn_part2": "秒后被请出房间",
"incorrect_password": "密码错误", "incorrect_password": "密码错误",
"file_not_found": "未找到文件 " "file_not_found": "未找到文件 "
} }
......
...@@ -77,7 +77,7 @@ ban_user = (name) -> ...@@ -77,7 +77,7 @@ ban_user = (name) ->
bad_ip = player.ip bad_ip = player.ip
ROOM_bad_ip[bad_ip]=99 ROOM_bad_ip[bad_ip]=99
settings.ban.banned_ip.push(player.ip) settings.ban.banned_ip.push(player.ip)
ygopro.stoc_send_chat_to_room(room, "#{player.name}${kicked_by_system}", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED)
player.destroy() player.destroy()
continue continue
return return
...@@ -402,7 +402,7 @@ class Room ...@@ -402,7 +402,7 @@ class Room
@process = spawn './ygopro', param, {cwd: 'ygopro'} @process = spawn './ygopro', param, {cwd: 'ygopro'}
@process.on 'error', (err)=> @process.on 'error', (err)=>
_.each @players, (player)-> _.each @players, (player)->
ygopro.stoc_die(player, "建立房间失败,请重试") ygopro.stoc_die(player, "${duel_room_new_failed}")
this.delete() this.delete()
return return
@process.on 'exit', (code)=> @process.on 'exit', (code)=>
...@@ -434,7 +434,7 @@ class Room ...@@ -434,7 +434,7 @@ class Room
@has_ygopro_error = true @has_ygopro_error = true
return return
catch catch
@error = "建立房间失败,请重试" @error = "${duel_room_new_failed}"
delete: -> delete: ->
return if @deleted return if @deleted
#log.info 'room-delete', this.name, ROOM_all.length #log.info 'room-delete', this.name, ROOM_all.length
...@@ -530,7 +530,7 @@ class Room ...@@ -530,7 +530,7 @@ class Room
, (error, response, body)=> , (error, response, body)=>
if error if error
log.warn 'windbot add error', error, this.name log.warn 'windbot add error', error, this.name
ygopro.stoc_send_chat_to_room(this, "添加AI失败,可尝试输入 /ai 重新添加", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(this, "${add_windbot_failed}", ygopro.constants.COLORS.RED)
#else #else
#log.info "windbot added" #log.info "windbot added"
return return
...@@ -560,7 +560,7 @@ class Room ...@@ -560,7 +560,7 @@ class Room
disconnect: (client, error)-> disconnect: (client, error)->
if client.is_post_watcher if client.is_post_watcher
ygopro.stoc_send_chat_to_room this, "#{client.name} 退出了观战" + if error then ": #{error}" else '' ygopro.stoc_send_chat_to_room this, "#{client.name} ${quit_watch}" + if error then ": #{error}" else ''
index = _.indexOf(@watchers, client) index = _.indexOf(@watchers, client)
@watchers.splice(index, 1) unless index == -1 @watchers.splice(index, 1) unless index == -1
#client.room = null #client.room = null
...@@ -572,9 +572,9 @@ class Room ...@@ -572,9 +572,9 @@ class Room
@finished = true @finished = true
@scores[client.name] = -1 @scores[client.name] = -1
if @random_type if @random_type
ROOM_ban_player(client.name, client.ip, "强退") ROOM_ban_player(client.name, client.ip, "${flee}")
if @players.length and !(@windbot and client.is_host) if @players.length and !(@windbot and client.is_host)
ygopro.stoc_send_chat_to_room this, "#{client.name} 离开了游戏" + if error then ": #{error}" else '' ygopro.stoc_send_chat_to_room this, "#{client.name} ${left_game}" + if error then ": #{error}" else ''
roomlist.update(this) if !@private and !@started and settings.modules.http.websocket_roomlist roomlist.update(this) if !@private and !@started and settings.modules.http.websocket_roomlist
#client.room = null #client.room = null
else else
...@@ -642,7 +642,7 @@ net.createServer (client) -> ...@@ -642,7 +642,7 @@ net.createServer (client) ->
room.disconnector = 'server' if room room.disconnector = 'server' if room
server.closed = true unless server.closed server.closed = true unless server.closed
unless client.closed unless client.closed
ygopro.stoc_send_chat(client, "服务器关闭了连接", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${server_closed}", ygopro.constants.COLORS.RED)
client.destroy() client.destroy()
return return
...@@ -654,7 +654,7 @@ net.createServer (client) -> ...@@ -654,7 +654,7 @@ net.createServer (client) ->
room.disconnector = 'server' if room room.disconnector = 'server' if room
server.closed = error server.closed = error
unless client.closed unless client.closed
ygopro.stoc_send_chat(client, "服务器错误: #{error}", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${server_error}: #{error}", ygopro.constants.COLORS.RED)
client.destroy() client.destroy()
return return
...@@ -666,17 +666,17 @@ net.createServer (client) -> ...@@ -666,17 +666,17 @@ net.createServer (client) ->
if settings.modules.cloud_replay.enabled if settings.modules.cloud_replay.enabled
client.open_cloud_replay= (err, replay)-> client.open_cloud_replay= (err, replay)->
if err or !replay if err or !replay
ygopro.stoc_die(client, "没有找到录像") ygopro.stoc_die(client, "${cloud_replay_no}")
return return
redisdb.expire("replay:"+replay.replay_id, 60*60*48) redisdb.expire("replay:"+replay.replay_id, 60*60*48)
buffer=new Buffer(replay.replay_buffer,'binary') buffer=new Buffer(replay.replay_buffer,'binary')
zlib.unzip buffer, (err, replay_buffer) -> zlib.unzip buffer, (err, replay_buffer) ->
if err if err
log.info "cloud replay unzip error: " + err log.info "cloud replay unzip error: " + err
ygopro.stoc_send_chat(client, "播放录像出错", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${cloud_replay_error}", ygopro.constants.COLORS.RED)
client.destroy() client.destroy()
return return
ygopro.stoc_send_chat(client, "正在观看云录像:R##{replay.replay_id} #{replay.player_names} #{replay.date_time}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${cloud_replay_playing} R##{replay.replay_id} #{replay.player_names} #{replay.date_time}", ygopro.constants.COLORS.BABYBLUE)
client.write replay_buffer, ()-> client.write replay_buffer, ()->
client.destroy() client.destroy()
return return
...@@ -855,7 +855,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -855,7 +855,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
ygopro.stoc_die(client, settings.modules.stop) ygopro.stoc_die(client, settings.modules.stop)
else if info.pass.toUpperCase()=="R" and settings.modules.cloud_replay.enabled else if info.pass.toUpperCase()=="R" and settings.modules.cloud_replay.enabled
ygopro.stoc_send_chat(client,"以下是您近期的云录像,密码处输入 R#录像编号 即可观看", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client,"${cloud_replay_hint}", ygopro.constants.COLORS.BABYBLUE)
redisdb.lrange client.ip+":replays", 0, 2, (err, result)-> redisdb.lrange client.ip+":replays", 0, 2, (err, result)->
_.each result, (replay_id,id)-> _.each result, (replay_id,id)->
redisdb.hgetall "replay:"+replay_id, (err, replay)-> redisdb.hgetall "replay:"+replay_id, (err, replay)->
...@@ -881,14 +881,14 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -881,14 +881,14 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
redisdb.lindex client.ip+":replays", replay_id-1, (err, replay_id)-> redisdb.lindex client.ip+":replays", replay_id-1, (err, replay_id)->
if err or !replay_id if err or !replay_id
log.info "cloud replay replayid error: " + err if err log.info "cloud replay replayid error: " + err if err
ygopro.stoc_die(client, "没有找到录像") ygopro.stoc_die(client, "${cloud_replay_no}")
return return
redisdb.hgetall "replay:"+replay_id, client.open_cloud_replay redisdb.hgetall "replay:"+replay_id, client.open_cloud_replay
return return
else if replay_id else if replay_id
redisdb.hgetall "replay:"+replay_id, client.open_cloud_replay redisdb.hgetall "replay:"+replay_id, client.open_cloud_replay
else else
ygopro.stoc_die(client, "没有找到录像") ygopro.stoc_die(client, "${cloud_replay_no}")
else if info.pass.toUpperCase()=="W" and settings.modules.cloud_replay.enabled else if info.pass.toUpperCase()=="W" and settings.modules.cloud_replay.enabled
replay_id=Cloud_replay_ids[Math.floor(Math.random()*Cloud_replay_ids.length)] replay_id=Cloud_replay_ids[Math.floor(Math.random()*Cloud_replay_ids.length)]
...@@ -903,18 +903,18 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -903,18 +903,18 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client.destroy() client.destroy()
else if !info.pass.length and !settings.modules.random_duel.enabled and !settings.modules.windbot.enabled else if !info.pass.length and !settings.modules.random_duel.enabled and !settings.modules.windbot.enabled
ygopro.stoc_die(client, "房间名不能为空,请在主机密码处填写房间名") ygopro.stoc_die(client, "${blank_room_name}")
else if info.pass.length and settings.modules.mycard.enabled and info.pass[0...3] != 'AI#' else if info.pass.length and settings.modules.mycard.enabled and info.pass[0...3] != 'AI#'
ygopro.stoc_send_chat(client, '正在读取用户信息...', ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, '${loading_user_info}', ygopro.constants.COLORS.BABYBLUE)
if info.pass.length <= 8 if info.pass.length <= 8
ygopro.stoc_die(client, '主机密码不正确 (Invalid Length)') ygopro.stoc_die(client, '${invalid_password_length}')
return return
buffer = new Buffer(info.pass[0...8], 'base64') buffer = new Buffer(info.pass[0...8], 'base64')
if buffer.length != 6 if buffer.length != 6
ygopro.stoc_die(client, '主机密码不正确 (Invalid Payload Length)') ygopro.stoc_die(client, '${invalid_password_payload}')
return return
check = (buf)-> check = (buf)->
...@@ -926,7 +926,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -926,7 +926,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
finish = (buffer)-> finish = (buffer)->
action = buffer.readUInt8(1) >> 4 action = buffer.readUInt8(1) >> 4
if buffer != decrypted_buffer and action in [1, 2, 4] if buffer != decrypted_buffer and action in [1, 2, 4]
ygopro.stoc_die(client, '主机密码不正确 (Unauthorized)') ygopro.stoc_die(client, '${invalid_password_unauthorized}')
return return
# 1 create public room # 1 create public room
...@@ -937,7 +937,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -937,7 +937,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
when 1,2 when 1,2
name = crypto.createHash('md5').update(info.pass + client.name).digest('base64')[0...10].replace('+', '-').replace('/', '_') name = crypto.createHash('md5').update(info.pass + client.name).digest('base64')[0...10].replace('+', '-').replace('/', '_')
if ROOM_find_by_name(name) if ROOM_find_by_name(name)
ygopro.stoc_die(client, '主机密码不正确 (Already Existed)') ygopro.stoc_die(client, '${invalid_password_existed}')
return return
opt1 = buffer.readUInt8(2) opt1 = buffer.readUInt8(2)
...@@ -963,18 +963,18 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -963,18 +963,18 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
name = info.pass.slice(8) name = info.pass.slice(8)
room = ROOM_find_by_name(name) room = ROOM_find_by_name(name)
if(!room) if(!room)
ygopro.stoc_die(client, '主机密码不正确 (Not Found)') ygopro.stoc_die(client, '${invalid_password_not_found}')
return return
when 4 when 4
room = ROOM_find_or_create_by_name('M#' + info.pass.slice(8)) room = ROOM_find_or_create_by_name('M#' + info.pass.slice(8))
room.private = true room.private = true
room.arena = settings.modules.arena_mode.mode room.arena = settings.modules.arena_mode.mode
else else
ygopro.stoc_die(client, '主机密码不正确 (Invalid Action)') ygopro.stoc_die(client, '${invalid_password_action}')
return return
if !room if !room
ygopro.stoc_die(client, "服务器已经爆满,请稍候再试") ygopro.stoc_die(client, "${server_full}")
else if room.error else if room.error
ygopro.stoc_die(client, room.error) ygopro.stoc_die(client, room.error)
else else
...@@ -1013,50 +1013,50 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1013,50 +1013,50 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
# buffer != decrypted_buffer ==> auth failed # buffer != decrypted_buffer ==> auth failed
if !check(buffer) if !check(buffer)
ygopro.stoc_die(client, '主机密码不正确 (Checksum Failed)') ygopro.stoc_die(client, '${invalid_password_checksum}')
return return
users_cache[client.name] = body.user.id users_cache[client.name] = body.user.id
finish(buffer) finish(buffer)
else if !client.name or client.name=="" else if !client.name or client.name==""
ygopro.stoc_die(client, "请输入正确的用户名") ygopro.stoc_die(client, "${enter_correct_user}")
else if ROOM_connected_ip[client.ip] > 5 else if ROOM_connected_ip[client.ip] > 5
log.warn("MULTI LOGIN", client.name, client.ip) log.warn("MULTI LOGIN", client.name, client.ip)
ygopro.stoc_die(client, "同时开启的客户端数量过多 " + client.ip) ygopro.stoc_die(client, "${client_overload}" + client.ip)
else if _.indexOf(settings.ban.banned_user, client.name) > -1 #账号被封 else if _.indexOf(settings.ban.banned_user, client.name) > -1 #账号被封
settings.ban.banned_ip.push(client.ip) settings.ban.banned_ip.push(client.ip)
log.warn("BANNED USER LOGIN", client.name, client.ip) log.warn("BANNED USER LOGIN", client.name, client.ip)
ygopro.stoc_die(client, "您的账号已被封禁") ygopro.stoc_die(client, "${banned_user_login}")
else if _.indexOf(settings.ban.banned_ip, client.ip) > -1 #IP被封 else if _.indexOf(settings.ban.banned_ip, client.ip) > -1 #IP被封
log.warn("BANNED IP LOGIN", client.name, client.ip) log.warn("BANNED IP LOGIN", client.name, client.ip)
ygopro.stoc_die(client, "您的账号已被封禁") ygopro.stoc_die(client, "${banned_ip_login}")
else if _.any(settings.ban.badword_level3, (badword) -> else if _.any(settings.ban.badword_level3, (badword) ->
regexp = new RegExp(badword, 'i') regexp = new RegExp(badword, 'i')
return name.match(regexp) return name.match(regexp)
, name = client.name) , name = client.name)
log.warn("BAD NAME LEVEL 3", client.name, client.ip) log.warn("BAD NAME LEVEL 3", client.name, client.ip)
ygopro.stoc_die(client, "您的用户名存在不适当的内容") ygopro.stoc_die(client, "${bad_name_level3}")
else if _.any(settings.ban.badword_level2, (badword) -> else if _.any(settings.ban.badword_level2, (badword) ->
regexp = new RegExp(badword, 'i') regexp = new RegExp(badword, 'i')
return name.match(regexp) return name.match(regexp)
, name = client.name) , name = client.name)
log.warn("BAD NAME LEVEL 2", client.name, client.ip) log.warn("BAD NAME LEVEL 2", client.name, client.ip)
ygopro.stoc_die(client, "您的用户名存在不适当的内容") ygopro.stoc_die(client, "${bad_name_level2}")
else if _.any(settings.ban.badword_level1, (badword) -> else if _.any(settings.ban.badword_level1, (badword) ->
regexp = new RegExp(badword, 'i') regexp = new RegExp(badword, 'i')
return name.match(regexp) return name.match(regexp)
, name = client.name) , name = client.name)
log.warn("BAD NAME LEVEL 1", client.name, client.ip) log.warn("BAD NAME LEVEL 1", client.name, client.ip)
ygopro.stoc_die(client, "您的用户名存在不适当的内容,请注意更改") ygopro.stoc_die(client, "${bad_name_level1}")
else if info.pass.length && !ROOM_validate(info.pass) else if info.pass.length && !ROOM_validate(info.pass)
ygopro.stoc_die(client, "房间密码不正确") ygopro.stoc_die(client, "${invalid_password_room}")
else else
if info.version == 4921 and settings.version == 4922 #YGOMobile不更新,强行兼容 if info.version == 4921 and settings.version == 4922 #YGOMobile不更新,强行兼容
...@@ -1065,12 +1065,12 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1065,12 +1065,12 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
struct._setBuff(buffer) struct._setBuff(buffer)
struct.set("version", info.version) struct.set("version", info.version)
buffer = struct.buffer buffer = struct.buffer
#ygopro.stoc_send_chat(client, "您的版本号过低,可能出现未知问题,电脑用户请升级版本,YGOMobile用户请等待作者更新", ygopro.constants.COLORS.BABYBLUE) #ygopro.stoc_send_chat(client, "${outdated_client}", ygopro.constants.COLORS.BABYBLUE)
#log.info 'join_game',info.pass, client.name #log.info 'join_game',info.pass, client.name
room = ROOM_find_or_create_by_name(info.pass, client.ip) room = ROOM_find_or_create_by_name(info.pass, client.ip)
if !room if !room
ygopro.stoc_die(client, "服务器已经爆满,请稍候再试") ygopro.stoc_die(client, "${server_full}")
else if room.error else if room.error
ygopro.stoc_die(client, room.error) ygopro.stoc_die(client, room.error)
else if room.started else if room.started
...@@ -1078,13 +1078,13 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1078,13 +1078,13 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client.setTimeout(300000) #连接后超时5分钟 client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room) client.rid = _.indexOf(ROOM_all, room)
client.is_post_watcher = true client.is_post_watcher = true
ygopro.stoc_send_chat_to_room(room, "#{client.name} 加入了观战") ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
room.watchers.push client room.watchers.push client
ygopro.stoc_send_chat(client, "观战中", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${watch_present}", ygopro.constants.COLORS.BABYBLUE)
for buffer in room.watcher_buffers for buffer in room.watcher_buffers
client.write buffer client.write buffer
else else
ygopro.stoc_die(client, "决斗已开始,不允许观战") ygopro.stoc_die(client, "${watch_denied}")
else else
client.setTimeout(300000) #连接后超时5分钟 client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room) client.rid = _.indexOf(ROOM_all, room)
...@@ -1110,8 +1110,8 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1110,8 +1110,8 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
log.warn 'LOAD SCORE FAIL', client.name, response.statusCode, response.statusMessage, body log.warn 'LOAD SCORE FAIL', client.name, response.statusCode, response.statusMessage, body
else else
#log.info 'LOAD SCORE', client.name, body #log.info 'LOAD SCORE', client.name, body
rank_txt = if body.arena_rank>0 then "排名第" + body.arena_rank else "暂无排名" rank_txt = if body.arena_rank>0 then "${rank_arena}" + body.arena_rank else "${rank_blank}"
ygopro.stoc_send_chat(client, "#{client.name},你有#{body.exp}点经验,你的战斗力是#{Math.round(body.pt)}#{rank_txt}。正式上线前这些积分可能被重置。", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "#{client.name}${exp_value_part1}#{body.exp}${exp_value_part2}${exp_value_part3}#{Math.round(body.pt)}#{rank_txt}${exp_value_part4}", ygopro.constants.COLORS.BABYBLUE)
#client.score_shown = true #client.score_shown = true
return return
...@@ -1220,7 +1220,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)-> ...@@ -1220,7 +1220,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
val = buffer.readInt32LE(2) val = buffer.readInt32LE(2)
room.dueling_players[pos].lp -= val room.dueling_players[pos].lp -= val
if 0 < room.dueling_players[pos].lp <= 100 if 0 < room.dueling_players[pos].lp <= 100
ygopro.stoc_send_chat_to_room(room, "你的生命已经如风中残烛了!", ygopro.constants.COLORS.PINK) ygopro.stoc_send_chat_to_room(room, "${lp_low_level1}", ygopro.constants.COLORS.PINK)
if ygopro.constants.MSG[msg] == 'RECOVER' and client.is_host if ygopro.constants.MSG[msg] == 'RECOVER' and client.is_host
pos = buffer.readUInt8(1) pos = buffer.readUInt8(1)
...@@ -1240,7 +1240,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)-> ...@@ -1240,7 +1240,7 @@ ygopro.stoc_follow 'GAME_MSG', false, (buffer, info, client, server)->
val = buffer.readInt32LE(2) val = buffer.readInt32LE(2)
room.dueling_players[pos].lp -= val room.dueling_players[pos].lp -= val
if 0 < room.dueling_players[pos].lp <= 100 if 0 < room.dueling_players[pos].lp <= 100
ygopro.stoc_send_chat_to_room(room, "背水一战!", ygopro.constants.COLORS.PINK) ygopro.stoc_send_chat_to_room(room, "${lp_low_level2}", ygopro.constants.COLORS.PINK)
#登场台词 #登场台词
if settings.modules.dialogues.enabled if settings.modules.dialogues.enabled
...@@ -1259,11 +1259,11 @@ ygopro.ctos_follow 'HS_KICK', true, (buffer, info, client, server)-> ...@@ -1259,11 +1259,11 @@ ygopro.ctos_follow 'HS_KICK', true, (buffer, info, client, server)->
if player and player.pos == info.pos and player != client if player and player.pos == info.pos and player != client
client.kick_count = if client.kick_count then client.kick_count+1 else 1 client.kick_count = if client.kick_count then client.kick_count+1 else 1
if client.kick_count>=5 if client.kick_count>=5
ygopro.stoc_send_chat_to_room(room, "#{client.name} 被系统请出了房间", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{client.name} ${kicked_by_system}", ygopro.constants.COLORS.RED)
ROOM_ban_player(player.name, player.ip, "挂房间") ROOM_ban_player(player.name, player.ip, "${zombie_player}")
client.destroy() client.destroy()
return true return true
ygopro.stoc_send_chat_to_room(room, "#{player.name} 被请出了房间", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{player.name} ${kicked_by_player}", ygopro.constants.COLORS.RED)
return false return false
ygopro.stoc_follow 'TYPE_CHANGE', false, (buffer, info, client, server)-> ygopro.stoc_follow 'TYPE_CHANGE', false, (buffer, info, client, server)->
...@@ -1296,13 +1296,13 @@ wait_room_start = (room, time)-> ...@@ -1296,13 +1296,13 @@ wait_room_start = (room, time)->
time -= 1 time -= 1
if time if time
unless time % 5 unless time % 5
ygopro.stoc_send_chat_to_room(room, "#{if time <= 9 then ' ' else ''}#{time}秒后房主若不开始游戏将被请出房间", if time <= 9 then ygopro.constants.COLORS.RED else ygopro.constants.COLORS.LIGHTBLUE) ygopro.stoc_send_chat_to_room(room, "#{if time <= 9 then ' ' else ''}#{time}${kicked_by_system_count_down}", if time <= 9 then ygopro.constants.COLORS.RED else ygopro.constants.COLORS.LIGHTBLUE)
setTimeout (()-> wait_room_start(room, time);return), 1000 setTimeout (()-> wait_room_start(room, time);return), 1000
else else
for player in room.players for player in room.players
if player and player.is_host if player and player.is_host
ROOM_ban_player(player.name, player.ip, "挂房间") ROOM_ban_player(player.name, player.ip, "${zombie_player}")
ygopro.stoc_send_chat_to_room(room, "#{player.name} 被系统请出了房间", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED)
player.destroy() player.destroy()
return return
...@@ -1389,11 +1389,11 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1389,11 +1389,11 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
cmd = msg.split(' ') cmd = msg.split(' ')
switch cmd[0] switch cmd[0]
when '/help' when '/help'
ygopro.stoc_send_chat(client, "YGOSrv233 指令帮助") ygopro.stoc_send_chat(client, "${chat_order_main}")
ygopro.stoc_send_chat(client, "/help 显示这个帮助信息") ygopro.stoc_send_chat(client, "${chat_order_help}")
ygopro.stoc_send_chat(client, "/roomname 显示当前房间的名字") if !settings.modules.mycard.enabled ygopro.stoc_send_chat(client, "${chat_order_roomname}") if !settings.modules.mycard.enabled
ygopro.stoc_send_chat(client, "/ai 添加一个AI,/ai 角色名 可指定添加的角色") if settings.modules.windbot.enabled ygopro.stoc_send_chat(client, "${chat_order_windbot}") if settings.modules.windbot.enabled
ygopro.stoc_send_chat(client, "/tip 显示一条提示") if settings.modules.tips.enabled ygopro.stoc_send_chat(client, "${chat_order_tip}") if settings.modules.tips.enabled
when '/tip' when '/tip'
ygopro.stoc_send_random_tip(client) if settings.modules.tips.enabled ygopro.stoc_send_random_tip(client) if settings.modules.tips.enabled
...@@ -1404,14 +1404,14 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1404,14 +1404,14 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
windbot = _.sample _.filter settings.modules.windbots, (w)-> windbot = _.sample _.filter settings.modules.windbots, (w)->
w.name == name or w.deck == name w.name == name or w.deck == name
if !windbot if !windbot
ygopro.stoc_send_chat(client, "未找到该AI角色或卡组", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${windbot_deck_not_found}", ygopro.constants.COLORS.RED)
return return
else else
windbot = _.sample settings.modules.windbots windbot = _.sample settings.modules.windbots
room.add_windbot(windbot) room.add_windbot(windbot)
when '/roomname' when '/roomname'
ygopro.stoc_send_chat(client, "您当前的房间名是 " + room.name, ygopro.constants.COLORS.BABYBLUE) if room ygopro.stoc_send_chat(client, "${room_name} " + room.name, ygopro.constants.COLORS.BABYBLUE) if room
#when '/test' #when '/test'
# ygopro.stoc_send_hint_card_to_room(room, 2333365) # ygopro.stoc_send_hint_card_to_room(room, 2333365)
...@@ -1419,7 +1419,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1419,7 +1419,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
return cancel return cancel
if client.abuse_count>=5 if client.abuse_count>=5
log.warn "BANNED CHAT", client.name, client.ip, msg log.warn "BANNED CHAT", client.name, client.ip, msg
ygopro.stoc_send_chat(client, "您已被禁言!", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${banned_chat_level1}", ygopro.constants.COLORS.RED)
return true return true
oldmsg = msg oldmsg = msg
if (_.any(settings.ban.badword_level3, (badword) -> if (_.any(settings.ban.badword_level3, (badword) ->
...@@ -1429,22 +1429,22 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1429,22 +1429,22 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
log.warn "BAD WORD LEVEL 3", client.name, client.ip, oldmsg log.warn "BAD WORD LEVEL 3", client.name, client.ip, oldmsg
cancel = true cancel = true
if client.abuse_count>0 if client.abuse_count>0
ygopro.stoc_send_chat(client, "您的发言存在严重不适当的内容,禁止您使用随机对战功能!", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${banned_chat_level2}", ygopro.constants.COLORS.RED)
ROOM_ban_player(client.name, client.ip, "发言违规") ROOM_ban_player(client.name, client.ip, "${chat_bad}")
ROOM_ban_player(client.name, client.ip, "发言违规", 3) ROOM_ban_player(client.name, client.ip, "${chat_bad}", 3)
client.destroy() client.destroy()
return true return true
else else
client.abuse_count=client.abuse_count+4 client.abuse_count=client.abuse_count+4
ygopro.stoc_send_chat(client, "您的发言存在不适当的内容,发送失败!", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${chat_warn_level2}", ygopro.constants.COLORS.RED)
else if (client.rag and room.started) else if (client.rag and room.started)
client.rag = false client.rag = false
#ygopro.stoc_send_chat(client, "发言失败", ygopro.constants.COLORS.RED) #ygopro.stoc_send_chat(client, "${chat_warn_level1}", ygopro.constants.COLORS.RED)
cancel = true cancel = true
else if (msg.length>100) else if (msg.length>100)
log.warn "SPAM WORD", client.name, client.ip, oldmsg log.warn "SPAM WORD", client.name, client.ip, oldmsg
client.abuse_count=client.abuse_count+2 client.abuse_count=client.abuse_count+2
ygopro.stoc_send_chat(client, "请不要发送垃圾信息!", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${chat_warn_level3}", ygopro.constants.COLORS.RED)
cancel = true cancel = true
else if (_.any(settings.ban.spam_word, (badword) -> else if (_.any(settings.ban.spam_word, (badword) ->
regexp = new RegExp(badword, 'i') regexp = new RegExp(badword, 'i')
...@@ -1452,7 +1452,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1452,7 +1452,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
, msg)) , msg))
#log.warn "SPAM WORD", client.name, client.ip, oldmsg #log.warn "SPAM WORD", client.name, client.ip, oldmsg
client.abuse_count=client.abuse_count+2 client.abuse_count=client.abuse_count+2
ygopro.stoc_send_chat(client, "请不要发送垃圾信息!", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${chat_warn_level3}", ygopro.constants.COLORS.RED)
cancel = true cancel = true
else if (_.any(settings.ban.badword_level2, (badword) -> else if (_.any(settings.ban.badword_level2, (badword) ->
regexp = new RegExp(badword, 'i') regexp = new RegExp(badword, 'i')
...@@ -1460,7 +1460,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1460,7 +1460,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
, msg)) , msg))
log.warn "BAD WORD LEVEL 2", client.name, client.ip, oldmsg log.warn "BAD WORD LEVEL 2", client.name, client.ip, oldmsg
client.abuse_count=client.abuse_count+3 client.abuse_count=client.abuse_count+3
ygopro.stoc_send_chat(client, "您的发言存在不适当的内容,发送失败!", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${chat_warn_level2}", ygopro.constants.COLORS.RED)
cancel = true cancel = true
else else
_.each(settings.ban.badword_level1, (badword) -> _.each(settings.ban.badword_level1, (badword) ->
...@@ -1472,7 +1472,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1472,7 +1472,7 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
if oldmsg != msg if oldmsg != msg
log.warn "BAD WORD LEVEL 1", client.name, client.ip, oldmsg log.warn "BAD WORD LEVEL 1", client.name, client.ip, oldmsg
client.abuse_count=client.abuse_count+1 client.abuse_count=client.abuse_count+1
ygopro.stoc_send_chat(client, "请使用文明用语!") ygopro.stoc_send_chat(client, "${chat_warn_level4}")
struct = ygopro.structs["chat"] struct = ygopro.structs["chat"]
struct._setBuff(buffer) struct._setBuff(buffer)
struct.set("msg", msg) struct.set("msg", msg)
...@@ -1483,8 +1483,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)-> ...@@ -1483,8 +1483,8 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
, msg)) , msg))
log.info "BAD WORD LEVEL 0", client.name, client.ip, oldmsg log.info "BAD WORD LEVEL 0", client.name, client.ip, oldmsg
if client.abuse_count>=5 if client.abuse_count>=5
ygopro.stoc_send_chat_to_room(room, "#{client.name} 已被禁言!", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{client.name} ${banned_chat_level3}", ygopro.constants.COLORS.RED)
ROOM_ban_player(client.name, client.ip, "发言违规") ROOM_ban_player(client.name, client.ip, "${chat_bad}")
return cancel return cancel
ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)-> ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)->
...@@ -1531,13 +1531,13 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)-> ...@@ -1531,13 +1531,13 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server)->
struct.set("deckbuf", deckbuf) struct.set("deckbuf", deckbuf)
buffer = struct.buffer buffer = struct.buffer
#log.info("deck ok: " + client.name) #log.info("deck ok: " + client.name)
ygopro.stoc_send_chat(client, "成功使用卡组 #{found_deck} 参加比赛。", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${deck_correct_part1} #{found_deck} ${deck_correct_part2}", ygopro.constants.COLORS.BABYBLUE)
else else
#log.info("bad deck: " + client.name + " / " + buff_main + " / " + buff_side) #log.info("bad deck: " + client.name + " / " + buff_main + " / " + buff_side)
ygopro.stoc_send_chat(client, "您的卡组与报名卡组 #{found_deck} 不符。注意卡组不能有包括卡片顺序在内的任何修改。", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${deck_incorrect_part1} #{found_deck} ${deck_incorrect_part2}", ygopro.constants.COLORS.RED)
else else
#log.info("player deck not found: " + client.name) #log.info("player deck not found: " + client.name)
ygopro.stoc_send_chat(client, "#{client.name},没有找到您的报名信息,请确定您使用昵称与报名ID一致。", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "#{client.name}${no_sign_up}", ygopro.constants.COLORS.RED)
return false return false
ygopro.ctos_follow 'RESPONSE', false, (buffer, info, client, server)-> ygopro.ctos_follow 'RESPONSE', false, (buffer, info, client, server)->
...@@ -1616,7 +1616,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)-> ...@@ -1616,7 +1616,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
if err then log.warn "SAVE REPLAY ERROR", replay_filename, err if err then log.warn "SAVE REPLAY ERROR", replay_filename, err
) )
if settings.modules.cloud_replay.enabled if settings.modules.cloud_replay.enabled
ygopro.stoc_send_chat(client, "本场比赛云录像:R##{room.cloud_replay_id}。将于本局结束后可播放。", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${cloud_replay_delay_part1}R##{room.cloud_replay_id}${cloud_replay_delay_part2}", ygopro.constants.COLORS.BABYBLUE)
return true return true
else else
return false return false
...@@ -1628,11 +1628,11 @@ if settings.modules.random_duel.enabled ...@@ -1628,11 +1628,11 @@ if settings.modules.random_duel.enabled
#log.info time_passed #log.info time_passed
if time_passed >= settings.modules.random_duel.hang_timeout if time_passed >= settings.modules.random_duel.hang_timeout
room.last_active_time = moment() room.last_active_time = moment()
ROOM_ban_player(room.waiting_for_player.name, room.waiting_for_player.ip, "挂机") ROOM_ban_player(room.waiting_for_player.name, room.waiting_for_player.ip, "${no_action}")
ygopro.stoc_send_chat_to_room(room, "#{room.waiting_for_player.name} 被系统请出了房间", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{room.waiting_for_player.name} ${no_action_kick}", ygopro.constants.COLORS.RED)
room.waiting_for_player.server.destroy() room.waiting_for_player.server.destroy()
else if time_passed >= (settings.modules.random_duel.hang_timeout - 20) and not (time_passed % 10) else if time_passed >= (settings.modules.random_duel.hang_timeout - 20) and not (time_passed % 10)
ygopro.stoc_send_chat_to_room(room, "#{room.waiting_for_player.name} 已经很久没有操作了,若继续挂机,将于#{settings.modules.random_duel.hang_timeout - time_passed}秒后被请出房间", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{room.waiting_for_player.name} ${no_action_warn_part1}#{settings.modules.random_duel.hang_timeout - time_passed}${no_action_warn_part2}", ygopro.constants.COLORS.RED)
return return
, 1000 , 1000
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
bad_ip = player.ip; bad_ip = player.ip;
ROOM_bad_ip[bad_ip] = 99; ROOM_bad_ip[bad_ip] = 99;
settings.ban.banned_ip.push(player.ip); settings.ban.banned_ip.push(player.ip);
ygopro.stoc_send_chat_to_room(room, player.name + "${kicked_by_system}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
player.destroy(); player.destroy();
continue; continue;
} }
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
if (bannedplayer) { if (bannedplayer) {
if (bannedplayer.count > 6 && moment() < bannedplayer.time) { if (bannedplayer.count > 6 && moment() < bannedplayer.time) {
return { return {
"error": "因为您近期在游戏中多次" + (bannedplayer.reasons.join('')) + ",您已被禁止使用随机对战功能,将在" + (moment(bannedplayer.time).fromNow(true)) + "后解封" "error": "${random_banned_part1}" + (bannedplayer.reasons.join('')) + "${random_banned_part2}" + (moment(bannedplayer.time).fromNow(true)) + "${random_banned_part3}"
}; };
} }
if (bannedplayer.count > 3 && moment() < bannedplayer.time && bannedplayer.need_tip) { if (bannedplayer.count > 3 && moment() < bannedplayer.time && bannedplayer.need_tip) {
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
} else if (bannedplayer.need_tip) { } else if (bannedplayer.need_tip) {
bannedplayer.need_tip = false; bannedplayer.need_tip = false;
return { return {
"error": "系统检测到您近期在游戏中" + (bannedplayer.reasons.join('')) + ",若您违规超过3次,将受到惩罚" "error": "${random_warn_part1}" + (bannedplayer.reasons.join('')) + "${random_warn_part2}"
}; };
} else if (bannedplayer.count > 2) { } else if (bannedplayer.count > 2) {
bannedplayer.need_tip = true; bannedplayer.need_tip = true;
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
return null; return null;
} }
if (result.random_type === 'M') { if (result.random_type === 'M') {
result.welcome = result.welcome + '\nrandom_duel_enter_room_match'; result.welcome = result.welcome + '\n${random_duel_enter_room_match}';
} }
return result; return result;
}; };
...@@ -346,7 +346,7 @@ ...@@ -346,7 +346,7 @@
})); }));
if (!windbot) { if (!windbot) {
return { return {
"error": "未找到该AI角色或卡组" "error": "${windbot_deck_not_found}"
}; };
} }
name = name + ',' + Math.floor(Math.random() * 100000); name = name + ',' + Math.floor(Math.random() * 100000);
...@@ -357,7 +357,7 @@ ...@@ -357,7 +357,7 @@
if (name.replace(/[^\x00-\xff]/g, "00").length > 20) { if (name.replace(/[^\x00-\xff]/g, "00").length > 20) {
log.info("long ai name", name); log.info("long ai name", name);
return { return {
"error": "AI房间名过长,请在建立房间后输入 /ai 来添加AI" "error": "${windbot_name_too_long}"
}; };
} }
result = new Room(name); result = new Room(name);
...@@ -533,7 +533,7 @@ ...@@ -533,7 +533,7 @@
this.process.on('error', (function(_this) { this.process.on('error', (function(_this) {
return function(err) { return function(err) {
_.each(_this.players, function(player) { _.each(_this.players, function(player) {
return ygopro.stoc_die(player, "建立房间失败,请重试"); return ygopro.stoc_die(player, "${duel_room_new_failed}");
}); });
_this["delete"](); _this["delete"]();
}; };
...@@ -583,7 +583,7 @@ ...@@ -583,7 +583,7 @@
}; };
})(this)); })(this));
} catch (error1) { } catch (error1) {
this.error = "建立房间失败,请重试"; this.error = "${duel_room_new_failed}";
} }
} }
...@@ -712,7 +712,7 @@ ...@@ -712,7 +712,7 @@
return function(error, response, body) { return function(error, response, body) {
if (error) { if (error) {
log.warn('windbot add error', error, _this.name); log.warn('windbot add error', error, _this.name);
ygopro.stoc_send_chat_to_room(_this, "添加AI失败,可尝试输入 /ai 重新添加", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(_this, "${add_windbot_failed}", ygopro.constants.COLORS.RED);
} }
}; };
})(this)); })(this));
...@@ -751,7 +751,7 @@ ...@@ -751,7 +751,7 @@
Room.prototype.disconnect = function(client, error) { Room.prototype.disconnect = function(client, error) {
var index; var index;
if (client.is_post_watcher) { if (client.is_post_watcher) {
ygopro.stoc_send_chat_to_room(this, (client.name + " 退出了观战") + (error ? ": " + error : '')); ygopro.stoc_send_chat_to_room(this, (client.name + " ${quit_watch}") + (error ? ": " + error : ''));
index = _.indexOf(this.watchers, client); index = _.indexOf(this.watchers, client);
if (index !== -1) { if (index !== -1) {
this.watchers.splice(index, 1); this.watchers.splice(index, 1);
...@@ -765,11 +765,11 @@ ...@@ -765,11 +765,11 @@
this.finished = true; this.finished = true;
this.scores[client.name] = -1; this.scores[client.name] = -1;
if (this.random_type) { if (this.random_type) {
ROOM_ban_player(client.name, client.ip, "强退"); ROOM_ban_player(client.name, client.ip, "${flee}");
} }
} }
if (this.players.length && !(this.windbot && client.is_host)) { if (this.players.length && !(this.windbot && client.is_host)) {
ygopro.stoc_send_chat_to_room(this, (client.name + " 离开了游戏") + (error ? ": " + error : '')); ygopro.stoc_send_chat_to_room(this, (client.name + " ${left_game}") + (error ? ": " + error : ''));
if (!this["private"] && !this.started && settings.modules.http.websocket_roomlist) { if (!this["private"] && !this.started && settings.modules.http.websocket_roomlist) {
roomlist.update(this); roomlist.update(this);
} }
...@@ -840,7 +840,7 @@ ...@@ -840,7 +840,7 @@
server.closed = true; server.closed = true;
} }
if (!client.closed) { if (!client.closed) {
ygopro.stoc_send_chat(client, "服务器关闭了连接", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${server_closed}", ygopro.constants.COLORS.RED);
client.destroy(); client.destroy();
} }
}); });
...@@ -852,7 +852,7 @@ ...@@ -852,7 +852,7 @@
} }
server.closed = error; server.closed = error;
if (!client.closed) { if (!client.closed) {
ygopro.stoc_send_chat(client, "服务器错误: " + error, ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${server_error}: " + error, ygopro.constants.COLORS.RED);
client.destroy(); client.destroy();
} }
}); });
...@@ -865,7 +865,7 @@ ...@@ -865,7 +865,7 @@
client.open_cloud_replay = function(err, replay) { client.open_cloud_replay = function(err, replay) {
var buffer; var buffer;
if (err || !replay) { if (err || !replay) {
ygopro.stoc_die(client, "没有找到录像"); ygopro.stoc_die(client, "${cloud_replay_no}");
return; return;
} }
redisdb.expire("replay:" + replay.replay_id, 60 * 60 * 48); redisdb.expire("replay:" + replay.replay_id, 60 * 60 * 48);
...@@ -873,11 +873,11 @@ ...@@ -873,11 +873,11 @@
zlib.unzip(buffer, function(err, replay_buffer) { zlib.unzip(buffer, function(err, replay_buffer) {
if (err) { if (err) {
log.info("cloud replay unzip error: " + err); log.info("cloud replay unzip error: " + err);
ygopro.stoc_send_chat(client, "播放录像出错", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${cloud_replay_error}", ygopro.constants.COLORS.RED);
client.destroy(); client.destroy();
return; return;
} }
ygopro.stoc_send_chat(client, "正在观看云录像:R#" + replay.replay_id + " " + replay.player_names + " " + replay.date_time, ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${cloud_replay_playing} R#" + replay.replay_id + " " + replay.player_names + " " + replay.date_time, ygopro.constants.COLORS.BABYBLUE);
client.write(replay_buffer, function() { client.write(replay_buffer, function() {
client.destroy(); client.destroy();
}); });
...@@ -1072,7 +1072,7 @@ ...@@ -1072,7 +1072,7 @@
if (settings.modules.stop) { if (settings.modules.stop) {
ygopro.stoc_die(client, settings.modules.stop); ygopro.stoc_die(client, settings.modules.stop);
} else if (info.pass.toUpperCase() === "R" && settings.modules.cloud_replay.enabled) { } else if (info.pass.toUpperCase() === "R" && settings.modules.cloud_replay.enabled) {
ygopro.stoc_send_chat(client, "以下是您近期的云录像,密码处输入 R#录像编号 即可观看", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${cloud_replay_hint}", ygopro.constants.COLORS.BABYBLUE);
redisdb.lrange(client.ip + ":replays", 0, 2, function(err, result) { redisdb.lrange(client.ip + ":replays", 0, 2, function(err, result) {
_.each(result, function(replay_id, id) { _.each(result, function(replay_id, id) {
redisdb.hgetall("replay:" + replay_id, function(err, replay) { redisdb.hgetall("replay:" + replay_id, function(err, replay) {
...@@ -1101,7 +1101,7 @@ ...@@ -1101,7 +1101,7 @@
if (err) { if (err) {
log.info("cloud replay replayid error: " + err); log.info("cloud replay replayid error: " + err);
} }
ygopro.stoc_die(client, "没有找到录像"); ygopro.stoc_die(client, "${cloud_replay_no}");
return; return;
} }
redisdb.hgetall("replay:" + replay_id, client.open_cloud_replay); redisdb.hgetall("replay:" + replay_id, client.open_cloud_replay);
...@@ -1109,7 +1109,7 @@ ...@@ -1109,7 +1109,7 @@
} else if (replay_id) { } else if (replay_id) {
redisdb.hgetall("replay:" + replay_id, client.open_cloud_replay); redisdb.hgetall("replay:" + replay_id, client.open_cloud_replay);
} else { } else {
ygopro.stoc_die(client, "没有找到录像"); ygopro.stoc_die(client, "${cloud_replay_no}");
} }
} else if (info.pass.toUpperCase() === "W" && settings.modules.cloud_replay.enabled) { } else if (info.pass.toUpperCase() === "W" && settings.modules.cloud_replay.enabled) {
replay_id = Cloud_replay_ids[Math.floor(Math.random() * Cloud_replay_ids.length)]; replay_id = Cloud_replay_ids[Math.floor(Math.random() * Cloud_replay_ids.length)];
...@@ -1122,16 +1122,16 @@ ...@@ -1122,16 +1122,16 @@
}); });
client.destroy(); client.destroy();
} else if (!info.pass.length && !settings.modules.random_duel.enabled && !settings.modules.windbot.enabled) { } else if (!info.pass.length && !settings.modules.random_duel.enabled && !settings.modules.windbot.enabled) {
ygopro.stoc_die(client, "房间名不能为空,请在主机密码处填写房间名"); ygopro.stoc_die(client, "${blank_room_name}");
} else if (info.pass.length && settings.modules.mycard.enabled && info.pass.slice(0, 3) !== 'AI#') { } else if (info.pass.length && settings.modules.mycard.enabled && info.pass.slice(0, 3) !== 'AI#') {
ygopro.stoc_send_chat(client, '正在读取用户信息...', ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, '${loading_user_info}', ygopro.constants.COLORS.BABYBLUE);
if (info.pass.length <= 8) { if (info.pass.length <= 8) {
ygopro.stoc_die(client, '主机密码不正确 (Invalid Length)'); ygopro.stoc_die(client, '${invalid_password_length}');
return; return;
} }
buffer = new Buffer(info.pass.slice(0, 8), 'base64'); buffer = new Buffer(info.pass.slice(0, 8), 'base64');
if (buffer.length !== 6) { if (buffer.length !== 6) {
ygopro.stoc_die(client, '主机密码不正确 (Invalid Payload Length)'); ygopro.stoc_die(client, '${invalid_password_payload}');
return; return;
} }
check = function(buf) { check = function(buf) {
...@@ -1146,7 +1146,7 @@ ...@@ -1146,7 +1146,7 @@
var action, name, opt1, opt2, opt3, options, room; var action, name, opt1, opt2, opt3, options, room;
action = buffer.readUInt8(1) >> 4; action = buffer.readUInt8(1) >> 4;
if (buffer !== decrypted_buffer && (action === 1 || action === 2 || action === 4)) { if (buffer !== decrypted_buffer && (action === 1 || action === 2 || action === 4)) {
ygopro.stoc_die(client, '主机密码不正确 (Unauthorized)'); ygopro.stoc_die(client, '${invalid_password_unauthorized}');
return; return;
} }
switch (action) { switch (action) {
...@@ -1154,7 +1154,7 @@ ...@@ -1154,7 +1154,7 @@
case 2: case 2:
name = crypto.createHash('md5').update(info.pass + client.name).digest('base64').slice(0, 10).replace('+', '-').replace('/', '_'); name = crypto.createHash('md5').update(info.pass + client.name).digest('base64').slice(0, 10).replace('+', '-').replace('/', '_');
if (ROOM_find_by_name(name)) { if (ROOM_find_by_name(name)) {
ygopro.stoc_die(client, '主机密码不正确 (Already Existed)'); ygopro.stoc_die(client, '${invalid_password_existed}');
return; return;
} }
opt1 = buffer.readUInt8(2); opt1 = buffer.readUInt8(2);
...@@ -1183,7 +1183,7 @@ ...@@ -1183,7 +1183,7 @@
name = info.pass.slice(8); name = info.pass.slice(8);
room = ROOM_find_by_name(name); room = ROOM_find_by_name(name);
if (!room) { if (!room) {
ygopro.stoc_die(client, '主机密码不正确 (Not Found)'); ygopro.stoc_die(client, '${invalid_password_not_found}');
return; return;
} }
break; break;
...@@ -1193,11 +1193,11 @@ ...@@ -1193,11 +1193,11 @@
room.arena = settings.modules.arena_mode.mode; room.arena = settings.modules.arena_mode.mode;
break; break;
default: default:
ygopro.stoc_die(client, '主机密码不正确 (Invalid Action)'); ygopro.stoc_die(client, '${invalid_password_action}');
return; return;
} }
if (!room) { if (!room) {
ygopro.stoc_die(client, "服务器已经爆满,请稍候再试"); ygopro.stoc_die(client, "${server_full}");
} else if (room.error) { } else if (room.error) {
ygopro.stoc_die(client, room.error); ygopro.stoc_die(client, room.error);
} else { } else {
...@@ -1242,47 +1242,47 @@ ...@@ -1242,47 +1242,47 @@
} }
} }
if (!check(buffer)) { if (!check(buffer)) {
ygopro.stoc_die(client, '主机密码不正确 (Checksum Failed)'); ygopro.stoc_die(client, '${invalid_password_checksum}');
return; return;
} }
users_cache[client.name] = body.user.id; users_cache[client.name] = body.user.id;
return finish(buffer); return finish(buffer);
}); });
} else if (!client.name || client.name === "") { } else if (!client.name || client.name === "") {
ygopro.stoc_die(client, "请输入正确的用户名"); ygopro.stoc_die(client, "${enter_correct_user}");
} else if (ROOM_connected_ip[client.ip] > 5) { } else if (ROOM_connected_ip[client.ip] > 5) {
log.warn("MULTI LOGIN", client.name, client.ip); log.warn("MULTI LOGIN", client.name, client.ip);
ygopro.stoc_die(client, "同时开启的客户端数量过多 " + client.ip); ygopro.stoc_die(client, "${client_overload}" + client.ip);
} else if (_.indexOf(settings.ban.banned_user, client.name) > -1) { } else if (_.indexOf(settings.ban.banned_user, client.name) > -1) {
settings.ban.banned_ip.push(client.ip); settings.ban.banned_ip.push(client.ip);
log.warn("BANNED USER LOGIN", client.name, client.ip); log.warn("BANNED USER LOGIN", client.name, client.ip);
ygopro.stoc_die(client, "您的账号已被封禁"); ygopro.stoc_die(client, "${banned_user_login}");
} else if (_.indexOf(settings.ban.banned_ip, client.ip) > -1) { } else if (_.indexOf(settings.ban.banned_ip, client.ip) > -1) {
log.warn("BANNED IP LOGIN", client.name, client.ip); log.warn("BANNED IP LOGIN", client.name, client.ip);
ygopro.stoc_die(client, "您的账号已被封禁"); ygopro.stoc_die(client, "${banned_ip_login}");
} else if (_.any(settings.ban.badword_level3, function(badword) { } else if (_.any(settings.ban.badword_level3, function(badword) {
var regexp; var regexp;
regexp = new RegExp(badword, 'i'); regexp = new RegExp(badword, 'i');
return name.match(regexp); return name.match(regexp);
}, name = client.name)) { }, name = client.name)) {
log.warn("BAD NAME LEVEL 3", client.name, client.ip); log.warn("BAD NAME LEVEL 3", client.name, client.ip);
ygopro.stoc_die(client, "您的用户名存在不适当的内容"); ygopro.stoc_die(client, "${bad_name_level3}");
} else if (_.any(settings.ban.badword_level2, function(badword) { } else if (_.any(settings.ban.badword_level2, function(badword) {
var regexp; var regexp;
regexp = new RegExp(badword, 'i'); regexp = new RegExp(badword, 'i');
return name.match(regexp); return name.match(regexp);
}, name = client.name)) { }, name = client.name)) {
log.warn("BAD NAME LEVEL 2", client.name, client.ip); log.warn("BAD NAME LEVEL 2", client.name, client.ip);
ygopro.stoc_die(client, "您的用户名存在不适当的内容"); ygopro.stoc_die(client, "${bad_name_level2}");
} else if (_.any(settings.ban.badword_level1, function(badword) { } else if (_.any(settings.ban.badword_level1, function(badword) {
var regexp; var regexp;
regexp = new RegExp(badword, 'i'); regexp = new RegExp(badword, 'i');
return name.match(regexp); return name.match(regexp);
}, name = client.name)) { }, name = client.name)) {
log.warn("BAD NAME LEVEL 1", client.name, client.ip); log.warn("BAD NAME LEVEL 1", client.name, client.ip);
ygopro.stoc_die(client, "您的用户名存在不适当的内容,请注意更改"); ygopro.stoc_die(client, "${bad_name_level1}");
} else if (info.pass.length && !ROOM_validate(info.pass)) { } else if (info.pass.length && !ROOM_validate(info.pass)) {
ygopro.stoc_die(client, "房间密码不正确"); ygopro.stoc_die(client, "${invalid_password_room}");
} else { } else {
if (info.version === 4921 && settings.version === 4922) { if (info.version === 4921 && settings.version === 4922) {
info.version = settings.version; info.version = settings.version;
...@@ -1293,7 +1293,7 @@ ...@@ -1293,7 +1293,7 @@
} }
room = ROOM_find_or_create_by_name(info.pass, client.ip); room = ROOM_find_or_create_by_name(info.pass, client.ip);
if (!room) { if (!room) {
ygopro.stoc_die(client, "服务器已经爆满,请稍候再试"); ygopro.stoc_die(client, "${server_full}");
} else if (room.error) { } else if (room.error) {
ygopro.stoc_die(client, room.error); ygopro.stoc_die(client, room.error);
} else if (room.started) { } else if (room.started) {
...@@ -1301,16 +1301,16 @@ ...@@ -1301,16 +1301,16 @@
client.setTimeout(300000); client.setTimeout(300000);
client.rid = _.indexOf(ROOM_all, room); client.rid = _.indexOf(ROOM_all, room);
client.is_post_watcher = true; client.is_post_watcher = true;
ygopro.stoc_send_chat_to_room(room, client.name + " 加入了观战"); ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}");
room.watchers.push(client); room.watchers.push(client);
ygopro.stoc_send_chat(client, "观战中", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${watch_present}", ygopro.constants.COLORS.BABYBLUE);
ref1 = room.watcher_buffers; ref1 = room.watcher_buffers;
for (l = 0, len1 = ref1.length; l < len1; l++) { for (l = 0, len1 = ref1.length; l < len1; l++) {
buffer = ref1[l]; buffer = ref1[l];
client.write(buffer); client.write(buffer);
} }
} else { } else {
ygopro.stoc_die(client, "决斗已开始,不允许观战"); ygopro.stoc_die(client, "${watch_denied}");
} }
} else { } else {
client.setTimeout(300000); client.setTimeout(300000);
...@@ -1343,8 +1343,8 @@ ...@@ -1343,8 +1343,8 @@
} else if (!body || _.isString(body)) { } else if (!body || _.isString(body)) {
log.warn('LOAD SCORE FAIL', client.name, response.statusCode, response.statusMessage, body); log.warn('LOAD SCORE FAIL', client.name, response.statusCode, response.statusMessage, body);
} else { } else {
rank_txt = body.arena_rank > 0 ? "排名第" + body.arena_rank : "暂无排名"; rank_txt = body.arena_rank > 0 ? "${rank_arena}" + body.arena_rank : "${rank_blank}";
ygopro.stoc_send_chat(client, client.name + ",你有" + body.exp + "点经验,你的战斗力是" + (Math.round(body.pt)) + "" + rank_txt + "。正式上线前这些积分可能被重置。", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, client.name + "${exp_value_part1}" + body.exp + "${exp_value_part2}${exp_value_part3}" + (Math.round(body.pt)) + rank_txt + "${exp_value_part4}", ygopro.constants.COLORS.BABYBLUE);
} }
}); });
} }
...@@ -1458,7 +1458,7 @@ ...@@ -1458,7 +1458,7 @@
val = buffer.readInt32LE(2); val = buffer.readInt32LE(2);
room.dueling_players[pos].lp -= val; room.dueling_players[pos].lp -= val;
if ((0 < (ref = room.dueling_players[pos].lp) && ref <= 100)) { if ((0 < (ref = room.dueling_players[pos].lp) && ref <= 100)) {
ygopro.stoc_send_chat_to_room(room, "你的生命已经如风中残烛了!", ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat_to_room(room, "${lp_low_level1}", ygopro.constants.COLORS.PINK);
} }
} }
if (ygopro.constants.MSG[msg] === 'RECOVER' && client.is_host) { if (ygopro.constants.MSG[msg] === 'RECOVER' && client.is_host) {
...@@ -1485,7 +1485,7 @@ ...@@ -1485,7 +1485,7 @@
val = buffer.readInt32LE(2); val = buffer.readInt32LE(2);
room.dueling_players[pos].lp -= val; room.dueling_players[pos].lp -= val;
if ((0 < (ref1 = room.dueling_players[pos].lp) && ref1 <= 100)) { if ((0 < (ref1 = room.dueling_players[pos].lp) && ref1 <= 100)) {
ygopro.stoc_send_chat_to_room(room, "背水一战!", ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat_to_room(room, "${lp_low_level2}", ygopro.constants.COLORS.PINK);
} }
} }
if (settings.modules.dialogues.enabled) { if (settings.modules.dialogues.enabled) {
...@@ -1514,12 +1514,12 @@ ...@@ -1514,12 +1514,12 @@
if (player && player.pos === info.pos && player !== client) { if (player && player.pos === info.pos && player !== client) {
client.kick_count = client.kick_count ? client.kick_count + 1 : 1; client.kick_count = client.kick_count ? client.kick_count + 1 : 1;
if (client.kick_count >= 5) { if (client.kick_count >= 5) {
ygopro.stoc_send_chat_to_room(room, client.name + " 被系统请出了房间", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, client.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
ROOM_ban_player(player.name, player.ip, "挂房间"); ROOM_ban_player(player.name, player.ip, "${zombie_player}");
client.destroy(); client.destroy();
return true; return true;
} }
ygopro.stoc_send_chat_to_room(room, player.name + " 被请出了房间", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_player}", ygopro.constants.COLORS.RED);
} }
} }
return false; return false;
...@@ -1567,7 +1567,7 @@ ...@@ -1567,7 +1567,7 @@
time -= 1; time -= 1;
if (time) { if (time) {
if (!(time % 5)) { if (!(time % 5)) {
ygopro.stoc_send_chat_to_room(room, "" + (time <= 9 ? ' ' : '') + time + "秒后房主若不开始游戏将被请出房间", time <= 9 ? ygopro.constants.COLORS.RED : ygopro.constants.COLORS.LIGHTBLUE); ygopro.stoc_send_chat_to_room(room, "" + (time <= 9 ? ' ' : '') + time + "${kicked_by_system_count_down}", time <= 9 ? ygopro.constants.COLORS.RED : ygopro.constants.COLORS.LIGHTBLUE);
} }
setTimeout((function() { setTimeout((function() {
wait_room_start(room, time); wait_room_start(room, time);
...@@ -1577,8 +1577,8 @@ ...@@ -1577,8 +1577,8 @@
for (k = 0, len = ref.length; k < len; k++) { for (k = 0, len = ref.length; k < len; k++) {
player = ref[k]; player = ref[k];
if (player && player.is_host) { if (player && player.is_host) {
ROOM_ban_player(player.name, player.ip, "挂房间"); ROOM_ban_player(player.name, player.ip, "${zombie_player}");
ygopro.stoc_send_chat_to_room(room, player.name + " 被系统请出了房间", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
player.destroy(); player.destroy();
} }
} }
...@@ -1708,16 +1708,16 @@ ...@@ -1708,16 +1708,16 @@
cmd = msg.split(' '); cmd = msg.split(' ');
switch (cmd[0]) { switch (cmd[0]) {
case '/help': case '/help':
ygopro.stoc_send_chat(client, "YGOSrv233 指令帮助"); ygopro.stoc_send_chat(client, "${chat_order_main}");
ygopro.stoc_send_chat(client, "/help 显示这个帮助信息"); ygopro.stoc_send_chat(client, "${chat_order_help}");
if (!settings.modules.mycard.enabled) { if (!settings.modules.mycard.enabled) {
ygopro.stoc_send_chat(client, "/roomname 显示当前房间的名字"); ygopro.stoc_send_chat(client, "${chat_order_roomname}");
} }
if (settings.modules.windbot.enabled) { if (settings.modules.windbot.enabled) {
ygopro.stoc_send_chat(client, "/ai 添加一个AI,/ai 角色名 可指定添加的角色"); ygopro.stoc_send_chat(client, "${chat_order_windbot}");
} }
if (settings.modules.tips.enabled) { if (settings.modules.tips.enabled) {
ygopro.stoc_send_chat(client, "/tip 显示一条提示"); ygopro.stoc_send_chat(client, "${chat_order_tip}");
} }
break; break;
case '/tip': case '/tip':
...@@ -1732,7 +1732,7 @@ ...@@ -1732,7 +1732,7 @@
return w.name === name || w.deck === name; return w.name === name || w.deck === name;
})); }));
if (!windbot) { if (!windbot) {
ygopro.stoc_send_chat(client, "未找到该AI角色或卡组", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${windbot_deck_not_found}", ygopro.constants.COLORS.RED);
return; return;
} }
} else { } else {
...@@ -1743,7 +1743,7 @@ ...@@ -1743,7 +1743,7 @@
break; break;
case '/roomname': case '/roomname':
if (room) { if (room) {
ygopro.stoc_send_chat(client, "您当前的房间名是 " + room.name, ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${room_name} " + room.name, ygopro.constants.COLORS.BABYBLUE);
} }
} }
if (!(room && room.random_type)) { if (!(room && room.random_type)) {
...@@ -1751,7 +1751,7 @@ ...@@ -1751,7 +1751,7 @@
} }
if (client.abuse_count >= 5) { if (client.abuse_count >= 5) {
log.warn("BANNED CHAT", client.name, client.ip, msg); log.warn("BANNED CHAT", client.name, client.ip, msg);
ygopro.stoc_send_chat(client, "您已被禁言!", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${banned_chat_level1}", ygopro.constants.COLORS.RED);
return true; return true;
} }
oldmsg = msg; oldmsg = msg;
...@@ -1763,14 +1763,14 @@ ...@@ -1763,14 +1763,14 @@
log.warn("BAD WORD LEVEL 3", client.name, client.ip, oldmsg); log.warn("BAD WORD LEVEL 3", client.name, client.ip, oldmsg);
cancel = true; cancel = true;
if (client.abuse_count > 0) { if (client.abuse_count > 0) {
ygopro.stoc_send_chat(client, "您的发言存在严重不适当的内容,禁止您使用随机对战功能!", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${banned_chat_level2}", ygopro.constants.COLORS.RED);
ROOM_ban_player(client.name, client.ip, "发言违规"); ROOM_ban_player(client.name, client.ip, "${chat_bad}");
ROOM_ban_player(client.name, client.ip, "发言违规", 3); ROOM_ban_player(client.name, client.ip, "${chat_bad}", 3);
client.destroy(); client.destroy();
return true; return true;
} else { } else {
client.abuse_count = client.abuse_count + 4; client.abuse_count = client.abuse_count + 4;
ygopro.stoc_send_chat(client, "您的发言存在不适当的内容,发送失败!", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${chat_warn_level2}", ygopro.constants.COLORS.RED);
} }
} else if (client.rag && room.started) { } else if (client.rag && room.started) {
client.rag = false; client.rag = false;
...@@ -1778,7 +1778,7 @@ ...@@ -1778,7 +1778,7 @@
} else if (msg.length > 100) { } else if (msg.length > 100) {
log.warn("SPAM WORD", client.name, client.ip, oldmsg); log.warn("SPAM WORD", client.name, client.ip, oldmsg);
client.abuse_count = client.abuse_count + 2; client.abuse_count = client.abuse_count + 2;
ygopro.stoc_send_chat(client, "请不要发送垃圾信息!", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${chat_warn_level3}", ygopro.constants.COLORS.RED);
cancel = true; cancel = true;
} else if (_.any(settings.ban.spam_word, function(badword) { } else if (_.any(settings.ban.spam_word, function(badword) {
var regexp; var regexp;
...@@ -1786,7 +1786,7 @@ ...@@ -1786,7 +1786,7 @@
return msg.match(regexp); return msg.match(regexp);
}, msg)) { }, msg)) {
client.abuse_count = client.abuse_count + 2; client.abuse_count = client.abuse_count + 2;
ygopro.stoc_send_chat(client, "请不要发送垃圾信息!", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${chat_warn_level3}", ygopro.constants.COLORS.RED);
cancel = true; cancel = true;
} else if (_.any(settings.ban.badword_level2, function(badword) { } else if (_.any(settings.ban.badword_level2, function(badword) {
var regexp; var regexp;
...@@ -1795,7 +1795,7 @@ ...@@ -1795,7 +1795,7 @@
}, msg)) { }, msg)) {
log.warn("BAD WORD LEVEL 2", client.name, client.ip, oldmsg); log.warn("BAD WORD LEVEL 2", client.name, client.ip, oldmsg);
client.abuse_count = client.abuse_count + 3; client.abuse_count = client.abuse_count + 3;
ygopro.stoc_send_chat(client, "您的发言存在不适当的内容,发送失败!", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${chat_warn_level2}", ygopro.constants.COLORS.RED);
cancel = true; cancel = true;
} else { } else {
_.each(settings.ban.badword_level1, function(badword) { _.each(settings.ban.badword_level1, function(badword) {
...@@ -1806,7 +1806,7 @@ ...@@ -1806,7 +1806,7 @@
if (oldmsg !== msg) { if (oldmsg !== msg) {
log.warn("BAD WORD LEVEL 1", client.name, client.ip, oldmsg); log.warn("BAD WORD LEVEL 1", client.name, client.ip, oldmsg);
client.abuse_count = client.abuse_count + 1; client.abuse_count = client.abuse_count + 1;
ygopro.stoc_send_chat(client, "请使用文明用语!"); ygopro.stoc_send_chat(client, "${chat_warn_level4}");
struct = ygopro.structs["chat"]; struct = ygopro.structs["chat"];
struct._setBuff(buffer); struct._setBuff(buffer);
struct.set("msg", msg); struct.set("msg", msg);
...@@ -1820,8 +1820,8 @@ ...@@ -1820,8 +1820,8 @@
} }
} }
if (client.abuse_count >= 5) { if (client.abuse_count >= 5) {
ygopro.stoc_send_chat_to_room(room, client.name + " 已被禁言!", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, client.name + " ${banned_chat_level3}", ygopro.constants.COLORS.RED);
ROOM_ban_player(client.name, client.ip, "发言违规"); ROOM_ban_player(client.name, client.ip, "${chat_bad}");
} }
return cancel; return cancel;
}); });
...@@ -1897,12 +1897,12 @@ ...@@ -1897,12 +1897,12 @@
struct.set("sidec", deck_side.length); struct.set("sidec", deck_side.length);
struct.set("deckbuf", deckbuf); struct.set("deckbuf", deckbuf);
buffer = struct.buffer; buffer = struct.buffer;
ygopro.stoc_send_chat(client, "成功使用卡组 " + found_deck + " 参加比赛。", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${deck_correct_part1} " + found_deck + " ${deck_correct_part2}", ygopro.constants.COLORS.BABYBLUE);
} else { } else {
ygopro.stoc_send_chat(client, "您的卡组与报名卡组 " + found_deck + " 不符。注意卡组不能有包括卡片顺序在内的任何修改。", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${deck_incorrect_part1} " + found_deck + " ${deck_incorrect_part2}", ygopro.constants.COLORS.RED);
} }
} else { } else {
ygopro.stoc_send_chat(client, client.name + ",没有找到您的报名信息,请确定您使用昵称与报名ID一致。", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, client.name + "${no_sign_up}", ygopro.constants.COLORS.RED);
} }
} }
return false; return false;
...@@ -2024,7 +2024,7 @@ ...@@ -2024,7 +2024,7 @@
}); });
} }
if (settings.modules.cloud_replay.enabled) { if (settings.modules.cloud_replay.enabled) {
ygopro.stoc_send_chat(client, "本场比赛云录像:R#" + room.cloud_replay_id + "。将于本局结束后可播放。", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${cloud_replay_delay_part1}R#" + room.cloud_replay_id + "${cloud_replay_delay_part2}", ygopro.constants.COLORS.BABYBLUE);
} }
return true; return true;
} else { } else {
...@@ -2043,11 +2043,11 @@ ...@@ -2043,11 +2043,11 @@
time_passed = Math.floor((moment() - room.last_active_time) / 1000); time_passed = Math.floor((moment() - room.last_active_time) / 1000);
if (time_passed >= settings.modules.random_duel.hang_timeout) { if (time_passed >= settings.modules.random_duel.hang_timeout) {
room.last_active_time = moment(); room.last_active_time = moment();
ROOM_ban_player(room.waiting_for_player.name, room.waiting_for_player.ip, "挂机"); ROOM_ban_player(room.waiting_for_player.name, room.waiting_for_player.ip, "${no_action}");
ygopro.stoc_send_chat_to_room(room, room.waiting_for_player.name + " 被系统请出了房间", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, room.waiting_for_player.name + " ${no_action_kick}", ygopro.constants.COLORS.RED);
room.waiting_for_player.server.destroy(); room.waiting_for_player.server.destroy();
} else if (time_passed >= (settings.modules.random_duel.hang_timeout - 20) && !(time_passed % 10)) { } else if (time_passed >= (settings.modules.random_duel.hang_timeout - 20) && !(time_passed % 10)) {
ygopro.stoc_send_chat_to_room(room, room.waiting_for_player.name + " 已经很久没有操作了,若继续挂机,将于" + (settings.modules.random_duel.hang_timeout - time_passed) + "秒后被请出房间", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, room.waiting_for_player.name + " ${no_action_warn_part1}" + (settings.modules.random_duel.hang_timeout - time_passed) + "${no_action_warn_part2}", ygopro.constants.COLORS.RED);
} }
} }
}, 1000); }, 1000);
......
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