Commit 6e36465f authored by nanahira's avatar nanahira

Merge branch 'master' into koishi

parents 22eceb68 0ad19f16
Pipeline #29617 passed with stages
in 20 minutes and 11 seconds
...@@ -90,6 +90,7 @@ ...@@ -90,6 +90,7 @@
"record_match_scores": false, "record_match_scores": false,
"post_match_scores": false, "post_match_scores": false,
"post_match_accesskey": "123456", "post_match_accesskey": "123456",
"disable_chat": false,
"blank_pass_modes": { "blank_pass_modes": {
"S": true, "S": true,
"M": true, "M": true,
......
...@@ -209,6 +209,7 @@ ...@@ -209,6 +209,7 @@
"refresh_failed": "Refresh field failed.", "refresh_failed": "Refresh field failed.",
"banned_athletic_deck_part1": "Entertainment Mode does not allow top ", "banned_athletic_deck_part1": "Entertainment Mode does not allow top ",
"banned_athletic_deck_part2": " popular meta decks. Please change your deck.", "banned_athletic_deck_part2": " popular meta decks. Please change your deck.",
"chat_disabled": "Chat is disabled in this room.",
"using_athletic_deck": " is using a competitive deck." "using_athletic_deck": " is using a competitive deck."
}, },
"es-es": { "es-es": {
...@@ -567,6 +568,7 @@ ...@@ -567,6 +568,7 @@
"refresh_fail": "刷新场面失败。", "refresh_fail": "刷新场面失败。",
"banned_athletic_deck_part1": "娱乐匹配中禁止使用使用数前", "banned_athletic_deck_part1": "娱乐匹配中禁止使用使用数前",
"banned_athletic_deck_part2": "的竞技卡组。请更换卡组。", "banned_athletic_deck_part2": "的竞技卡组。请更换卡组。",
"chat_disabled": "本房间禁止聊天。",
"using_athletic_deck": " 正在使用竞技卡组。" "using_athletic_deck": " 正在使用竞技卡组。"
}, },
"ko-kr": { "ko-kr": {
......
...@@ -395,6 +395,9 @@ loadLFList = (path) -> ...@@ -395,6 +395,9 @@ loadLFList = (path) ->
} }
delete settings.modules.random_duel.blank_pass_match delete settings.modules.random_duel.blank_pass_match
imported = true imported = true
if settings.modules.hide_name == true
settings.modules.hide_name = "start"
imported = true
#finish #finish
keysFromEnv = Object.keys(process.env).filter((key) => key.startsWith('SRVPRO_')) keysFromEnv = Object.keys(process.env).filter((key) => key.startsWith('SRVPRO_'))
if keysFromEnv.length > 0 if keysFromEnv.length > 0
...@@ -1818,7 +1821,7 @@ class Room ...@@ -1818,7 +1821,7 @@ class Room
if settings.modules.random_duel.record_match_scores and @random_type == 'M' if settings.modules.random_duel.record_match_scores and @random_type == 'M'
ROOM_player_flee(client.name_vpass) ROOM_player_flee(client.name_vpass)
if @players.length and !(@windbot and client.is_host and @duel_stage == ygopro.constants.DUEL_STAGE.BEGIN) and !(@arena and @duel_stage == ygopro.constants.DUEL_STAGE.BEGIN and client.pos <= 3) if @players.length and !(@windbot and client.is_host and @duel_stage == ygopro.constants.DUEL_STAGE.BEGIN) and !(@arena and @duel_stage == ygopro.constants.DUEL_STAGE.BEGIN and client.pos <= 3)
left_name = (if settings.modules.hide_name and @duel_stage == ygopro.constants.DUEL_STAGE.BEGIN then "********" else client.name) left_name = @getMaskedPlayerName(client)
ygopro.stoc_send_chat_to_room this, "#{left_name} ${left_game}" + if error then ": #{error}" else '' ygopro.stoc_send_chat_to_room this, "#{left_name} ${left_game}" + if error then ": #{error}" else ''
roomlist.update(this) if !@windbot and @duel_stage == ygopro.constants.DUEL_STAGE.BEGIN and settings.modules.http.websocket_roomlist roomlist.update(this) if !@windbot and @duel_stage == ygopro.constants.DUEL_STAGE.BEGIN and settings.modules.http.websocket_roomlist
#client.room = null #client.room = null
...@@ -1828,7 +1831,7 @@ class Room ...@@ -1828,7 +1831,7 @@ class Room
#client.room = null #client.room = null
this.delete() this.delete()
if !CLIENT_reconnect_unregister(client, false, true) if !CLIENT_reconnect_unregister(client, false, true)
SERVER_kick(client.server) SERVER_kick(client.server)
return return
start_death: () -> start_death: () ->
...@@ -1992,6 +1995,15 @@ class Room ...@@ -1992,6 +1995,15 @@ class Room
@watcher_buffers.push chat_buf @watcher_buffers.push chat_buf
return return
getMaskedPlayerName(player, sight_player) ->
if not settings.modules.hide_name or (sight_player and player == sight_player) or not (@random_type or @arena)
return player.name
if @duel_stage == ygopro.constants.DUEL_STAGE.BEGIN and settings.modules.hide_name == "start"
return "********"
if settings.modules.hide_name == "always"
return "********"
return player.name
# 网络连接 # 网络连接
netRequestHandler = (client) -> netRequestHandler = (client) ->
if !client.isWs if !client.isWs
...@@ -3035,13 +3047,13 @@ ygopro.stoc_follow 'TYPE_CHANGE', true, (buffer, info, client, server, datas)-> ...@@ -3035,13 +3047,13 @@ ygopro.stoc_follow 'TYPE_CHANGE', true, (buffer, info, client, server, datas)->
ygopro.stoc_follow 'HS_PLAYER_ENTER', true, (buffer, info, client, server, datas)-> ygopro.stoc_follow 'HS_PLAYER_ENTER', true, (buffer, info, client, server, datas)->
room=ROOM_all[client.rid] room=ROOM_all[client.rid]
return false unless room and settings.modules.hide_name and room.duel_stage == ygopro.constants.DUEL_STAGE.BEGIN if room and settings.modules.hide_name and room.duel_stage == ygopro.constants.DUEL_STAGE.BEGIN
pos = info.pos pos = info.pos
if pos < 4 and pos != client.pos if pos < 4 and pos != client.pos
struct = ygopro.structs.get("STOC_HS_PlayerEnter") struct = ygopro.structs.get("STOC_HS_PlayerEnter")
struct._setBuff(buffer) struct._setBuff(buffer)
struct.set("name", "********") struct.set("name", "********")
buffer = struct.buffer buffer = struct.buffer
await return false await return false
ygopro.stoc_follow 'HS_PLAYER_CHANGE', true, (buffer, info, client, server, datas)-> ygopro.stoc_follow 'HS_PLAYER_CHANGE', true, (buffer, info, client, server, datas)->
...@@ -3144,7 +3156,7 @@ wait_room_start_arena = (room)-> ...@@ -3144,7 +3156,7 @@ wait_room_start_arena = (room)->
if room.waiting_for_player_time > 0 if room.waiting_for_player_time > 0
unless room.waiting_for_player_time % 5 unless room.waiting_for_player_time % 5
for player in room.players when player for player in room.players when player
display_name = (if settings.modules.hide_name and player != room.waiting_for_player then "********" else room.waiting_for_player.name) display_name = room.getMaskedPlayerName(player, room.waiting_for_player)
ygopro.stoc_send_chat(player, "#{if room.waiting_for_player_time <= 9 then ' ' else ''}#{room.waiting_for_player_time}${kick_count_down_arena_part1} #{display_name} ${kick_count_down_arena_part2}", if room.waiting_for_player_time <= 9 then ygopro.constants.COLORS.RED else ygopro.constants.COLORS.LIGHTBLUE) ygopro.stoc_send_chat(player, "#{if room.waiting_for_player_time <= 9 then ' ' else ''}#{room.waiting_for_player_time}${kick_count_down_arena_part1} #{display_name} ${kick_count_down_arena_part2}", if room.waiting_for_player_time <= 9 then ygopro.constants.COLORS.RED else ygopro.constants.COLORS.LIGHTBLUE)
else else
ygopro.stoc_send_chat_to_room(room, "#{room.waiting_for_player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{room.waiting_for_player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED)
...@@ -3218,7 +3230,7 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server, datas)-> ...@@ -3218,7 +3230,7 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server, datas)->
clearInterval client.side_interval clearInterval client.side_interval
client.side_interval = null client.side_interval = null
client.side_tcount = null client.side_tcount = null
if settings.modules.hide_name and room.duel_count == 0 if settings.modules.hide_name == "start" and room.duel_count == 0
for player in room.get_playing_player() when player != client for player in room.get_playing_player() when player != client
ygopro.stoc_send(client, 'HS_PLAYER_ENTER', { ygopro.stoc_send(client, 'HS_PLAYER_ENTER', {
name: player.name, name: player.name,
...@@ -3526,6 +3538,9 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)-> ...@@ -3526,6 +3538,9 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server, datas)->
ygopro.stoc_send_chat_to_room(room, "#{client.name}: #{msg}", 9) ygopro.stoc_send_chat_to_room(room, "#{client.name}: #{msg}", 9)
return true return true
return cancel return cancel
if room.random_type and settings.modules.random_duel.disable_chat
ygopro.stoc_send_chat(client, "${chat_disabled}", ygopro.constants.COLORS.BABYBLUE)
return true
if client.abuse_count>=5 or CLIENT_is_banned_by_mc(client) if client.abuse_count>=5 or CLIENT_is_banned_by_mc(client)
log.warn "BANNED CHAT", client.name, client.ip, msg log.warn "BANNED CHAT", client.name, client.ip, msg
ygopro.stoc_send_chat(client, "${banned_chat_tip}" + (if client.ban_mc and client.ban_mc.message then (": " + client.ban_mc.message) else ""), ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${banned_chat_tip}" + (if client.ban_mc and client.ban_mc.message then (": " + client.ban_mc.message) else ""), ygopro.constants.COLORS.RED)
......
This diff is collapsed.
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