Commit 012768b3 authored by nanahira's avatar nanahira

Merge branch 'mc'

parents 74ef3510 5a5ea90b
......@@ -22,6 +22,7 @@
"side_timeout": false,
"tag_duel_surrender": true,
"replay_delay": false,
"hide_name": false,
"i18n": {
"auto_pick": false,
"default": "zh-cn",
......
......@@ -1519,7 +1519,8 @@ class Room
if settings.modules.random_duel.record_match_scores and @random_type == 'M'
ROOM_player_flee(client.name_vpass)
if @players.length and !(@windbot and client.is_host) and !(@arena and !@started and client.pos <= 3)
ygopro.stoc_send_chat_to_room this, "#{client.name} ${left_game}" + if error then ": #{error}" else ''
left_name = (if settings.modules.hide_name and !@started then "********" else client.name)
ygopro.stoc_send_chat_to_room this, "#{left_name} ${left_game}" + if error then ": #{error}" else ''
roomlist.update(this) if !@windbot and !@started and settings.modules.http.websocket_roomlist
#client.room = null
else
......@@ -2775,6 +2776,17 @@ ygopro.stoc_follow 'TYPE_CHANGE', true, (buffer, info, client, server, datas)->
#console.log "TYPE_CHANGE to #{client.name}:", info, selftype, is_host
return false
ygopro.stoc_follow 'HS_PLAYER_ENTER', true, (buffer, info, client, server, datas)->
room=ROOM_all[client.rid]
return false unless room and settings.modules.hide_name and !room.started
pos = info.pos
if pos < 4 and pos != client.pos
struct = ygopro.structs["STOC_HS_PlayerEnter"]
struct._setBuff(buffer)
struct.set("name", "********")
buffer = struct.buffer
return false
ygopro.stoc_follow 'HS_PLAYER_CHANGE', false, (buffer, info, client, server, datas)->
room=ROOM_all[client.rid]
return unless room and room.max_player and client.is_host
......@@ -2868,7 +2880,9 @@ wait_room_start_arena = (room)->
room.waiting_for_player_time = room.waiting_for_player_time - 1
if room.waiting_for_player_time > 0
unless room.waiting_for_player_time % 5
ygopro.stoc_send_chat_to_room(room, "#{if room.waiting_for_player_time <= 9 then ' ' else ''}#{room.waiting_for_player_time}${kick_count_down_arena_part1} #{room.waiting_for_player.name} ${kick_count_down_arena_part2}", if room.waiting_for_player_time <= 9 then ygopro.constants.COLORS.RED else ygopro.constants.COLORS.LIGHTBLUE)
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)
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
ygopro.stoc_send_chat_to_room(room, "#{room.waiting_for_player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED)
CLIENT_kick(room.waiting_for_player)
......@@ -2951,6 +2965,12 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server, datas)->
if room.random_type == 'T'
# 双打房不记录匹配过
ROOM_players_oppentlist[player.ip] = null
if settings.modules.hide_name and room.duel_count == 0
for player in room.get_playing_player() when player != client
ygopro.stoc_send(client, 'HS_PLAYER_ENTER', {
name: player.name,
pos: player.pos
})
if settings.modules.tips.enabled
ygopro.stoc_send_random_tip(client)
deck_text = null
......@@ -3508,7 +3528,7 @@ ygopro.ctos_follow 'TP_RESULT', false, (buffer, info, client, server, datas)->
ygopro.stoc_follow 'CHAT', true, (buffer, info, client, server, datas)->
room=ROOM_all[client.rid]
pid = info.player
return unless room and pid < 4 and settings.modules.chat_color.enabled
return unless room and pid < 4 and settings.modules.chat_color.enabled and (!settings.modules.hide_name or room.started)
if room.started and room.turn > 0 and !room.dueling_players[0].is_first
if room.hostinfo.mode == 2
pid = {
......
......@@ -1948,7 +1948,7 @@
};
Room.prototype.disconnect = function(client, error) {
var index, len3, m, player, ref3;
var index, left_name, len3, m, player, ref3;
if (client.had_new_reconnection) {
return;
}
......@@ -1990,7 +1990,8 @@
}
}
if (this.players.length && !(this.windbot && client.is_host) && !(this.arena && !this.started && client.pos <= 3)) {
ygopro.stoc_send_chat_to_room(this, (client.name + " ${left_game}") + (error ? ": " + error : ''));
left_name = (settings.modules.hide_name && !this.started ? "********" : client.name);
ygopro.stoc_send_chat_to_room(this, (left_name + " ${left_game}") + (error ? ": " + error : ''));
if (!this.windbot && !this.started && settings.modules.http.websocket_roomlist) {
roomlist.update(this);
}
......@@ -3487,6 +3488,22 @@
return false;
});
ygopro.stoc_follow('HS_PLAYER_ENTER', true, function(buffer, info, client, server, datas) {
var pos, room, struct;
room = ROOM_all[client.rid];
if (!(room && settings.modules.hide_name && !room.started)) {
return false;
}
pos = info.pos;
if (pos < 4 && pos !== client.pos) {
struct = ygopro.structs["STOC_HS_PlayerEnter"];
struct._setBuff(buffer);
struct.set("name", "********");
buffer = struct.buffer;
}
return false;
});
ygopro.stoc_follow('HS_PLAYER_CHANGE', false, function(buffer, info, client, server, datas) {
var is_ready, len3, len4, m, n, p1, p2, player, pos, ref3, ref4, room;
room = ROOM_all[client.rid];
......@@ -3634,11 +3651,20 @@
};
wait_room_start_arena = function(room) {
var display_name, len3, m, player, ref3;
if (!(!room || room.started || !room.waiting_for_player)) {
room.waiting_for_player_time = room.waiting_for_player_time - 1;
if (room.waiting_for_player_time > 0) {
if (!(room.waiting_for_player_time % 5)) {
ygopro.stoc_send_chat_to_room(room, "" + (room.waiting_for_player_time <= 9 ? ' ' : '') + room.waiting_for_player_time + "${kick_count_down_arena_part1} " + room.waiting_for_player.name + " ${kick_count_down_arena_part2}", room.waiting_for_player_time <= 9 ? ygopro.constants.COLORS.RED : ygopro.constants.COLORS.LIGHTBLUE);
ref3 = room.players;
for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref3[m];
if (!(player)) {
continue;
}
display_name = (settings.modules.hide_name && player !== room.waiting_for_player ? "********" : room.waiting_for_player.name);
ygopro.stoc_send_chat(player, "" + (room.waiting_for_player_time <= 9 ? ' ' : '') + room.waiting_for_player_time + "${kick_count_down_arena_part1} " + display_name + " ${kick_count_down_arena_part2}", room.waiting_for_player_time <= 9 ? ygopro.constants.COLORS.RED : ygopro.constants.COLORS.LIGHTBLUE);
}
}
} else {
ygopro.stoc_send_chat_to_room(room, room.waiting_for_player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
......@@ -3737,7 +3763,7 @@
}
ygopro.stoc_follow('DUEL_START', false, function(buffer, info, client, server, datas) {
var deck_arena, deck_name, deck_text, len3, m, player, ref3, room;
var deck_arena, deck_name, deck_text, len3, len4, m, n, player, ref3, ref4, room;
room = ROOM_all[client.rid];
if (!(room && !client.reconnecting)) {
return;
......@@ -3767,6 +3793,18 @@
}
}
}
if (settings.modules.hide_name && room.duel_count === 0) {
ref4 = room.get_playing_player();
for (n = 0, len4 = ref4.length; n < len4; n++) {
player = ref4[n];
if (player !== client) {
ygopro.stoc_send(client, 'HS_PLAYER_ENTER', {
name: player.name,
pos: player.pos
});
}
}
}
if (settings.modules.tips.enabled) {
ygopro.stoc_send_random_tip(client);
}
......@@ -4516,7 +4554,7 @@
var len3, m, pid, player, ref3, room, tcolor, tplayer;
room = ROOM_all[client.rid];
pid = info.player;
if (!(room && pid < 4 && settings.modules.chat_color.enabled)) {
if (!(room && pid < 4 && settings.modules.chat_color.enabled && (!settings.modules.hide_name || room.started))) {
return;
}
if (room.started && room.turn > 0 && !room.dueling_players[0].is_first) {
......
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