Commit 1b17e6ca authored by nanahira's avatar nanahira

update

parent 0f5c4d51
......@@ -442,9 +442,9 @@ CLIENT_reconnect_register = (client, room_id, error) ->
return false
if !settings.modules.reconnect.enabled or !room or client.system_kicked or disconnect_list[CLIENT_get_authorize_key(client)] or client.is_post_watcher or !CLIENT_is_player(client, room) or !room.started or (room.windbot and client.is_local) or (settings.modules.reconnect.auto_surrender_after_disconnect and room.hostinfo.mode != 1)
return false
for player in room.players
if player != client and CLIENT_get_authorize_key(player) == CLIENT_get_authorize_key(client)
return false # some issues may occur in this case, so return false
# for player in room.players
# if player != client and CLIENT_get_authorize_key(player) == CLIENT_get_authorize_key(client)
# return false # some issues may occur in this case, so return false
dinfo = {
room_id: room_id,
old_client: client,
......@@ -497,6 +497,7 @@ CLIENT_import_data = (client, old_client, room) ->
client.selected_preduel = old_client.selected_preduel
client.last_game_msg = old_client.last_game_msg
client.last_game_msg_title = old_client.last_game_msg_title
client.last_hint_msg = old_client.last_hint_msg
client.start_deckbuf = old_client.start_deckbuf
old_client.had_new_reconnection = true
return
......@@ -1621,14 +1622,18 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
ygopro.stoc_send_chat(client, "${retry_part1}" + client.retry_count + "${retry_part2}" + settings.modules.retry_handle.max_retry_count + "${retry_part3}", ygopro.constants.COLORS.RED)
else
ygopro.stoc_send_chat(client, "${retry_not_counted}", ygopro.constants.COLORS.BABYBLUE)
if client.last_hint_msg
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg)
ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg)
return true
else
client.last_game_msg = buffer
client.last_game_msg_title = ygopro.constants.MSG[msg]
# log.info(client.name, client.last_game_msg_title)
else if ygopro.constants.MSG[msg] != 'RETRY'
client.last_game_msg = buffer
client.last_game_msg_title = ygopro.constants.MSG[msg]
# log.info(client.name, client.last_game_msg_title)
if (msg >= 10 and msg < 30) or msg == 132 or (msg >= 140 and msg < 144) #SELECT和ANNOUNCE开头的消息
room.waiting_for_player = client
......@@ -1655,6 +1660,11 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server)->
client.last_game_msg = null
#ygopro.stoc_send_chat_to_room(room, "LP跟踪调试信息: #{client.name} 初始LP #{client.lp}")
if ygopro.constants.MSG[msg] == 'HINT'
hint_type = buffer.readUInt8(1)
if hint_type = 3
client.last_hint_msg = buffer
if ygopro.constants.MSG[msg] == 'NEW_TURN'
if client.pos == 0
......@@ -1872,11 +1882,15 @@ ygopro.stoc_follow 'FIELD_FINISH', true, (buffer, info, client, server)->
room=ROOM_all[client.rid]
return unless room
client.reconnecting = false
if client.last_game_msg and client.last_game_msg_title != 'WAITING'
if !client.last_game_msg
return true
if client.last_game_msg_title != 'WAITING'
setTimeout( () ->
if client.last_hint_msg
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg)
ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg)
return
, 200)
, 50)
return true
wait_room_start = (room, time)->
......
......@@ -601,7 +601,7 @@
};
CLIENT_reconnect_register = function(client, room_id, error) {
var dinfo, len2, m, player, ref2, room, tmot;
var dinfo, room, tmot;
room = ROOM_all[room_id];
if (client.had_new_reconnection) {
return false;
......@@ -609,13 +609,6 @@
if (!settings.modules.reconnect.enabled || !room || client.system_kicked || disconnect_list[CLIENT_get_authorize_key(client)] || client.is_post_watcher || !CLIENT_is_player(client, room) || !room.started || (room.windbot && client.is_local) || (settings.modules.reconnect.auto_surrender_after_disconnect && room.hostinfo.mode !== 1)) {
return false;
}
ref2 = room.players;
for (m = 0, len2 = ref2.length; m < len2; m++) {
player = ref2[m];
if (player !== client && CLIENT_get_authorize_key(player) === CLIENT_get_authorize_key(client)) {
return false;
}
}
dinfo = {
room_id: room_id,
old_client: client,
......@@ -675,6 +668,7 @@
client.selected_preduel = old_client.selected_preduel;
client.last_game_msg = old_client.last_game_msg;
client.last_game_msg_title = old_client.last_game_msg_title;
client.last_hint_msg = old_client.last_hint_msg;
client.start_deckbuf = old_client.start_deckbuf;
old_client.had_new_reconnection = true;
};
......@@ -1957,7 +1951,7 @@
}
ygopro.stoc_follow('GAME_MSG', true, function(buffer, info, client, server) {
var card, count, len2, line, loc, m, msg, oppo_pos, phase, playertype, pos, reason, ref2, ref3, ref4, room, trigger_location, val, win_pos;
var card, count, hint_type, len2, line, loc, m, msg, oppo_pos, phase, playertype, pos, reason, ref2, ref3, ref4, room, trigger_location, val, win_pos;
room = ROOM_all[client.rid];
if (!(room && !client.reconnecting)) {
return;
......@@ -1982,6 +1976,9 @@
} else {
ygopro.stoc_send_chat(client, "${retry_not_counted}", ygopro.constants.COLORS.BABYBLUE);
}
if (client.last_hint_msg) {
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg);
}
ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg);
return true;
}
......@@ -2021,6 +2018,12 @@
client.last_game_msg = null;
}
}
if (ygopro.constants.MSG[msg] === 'HINT') {
hint_type = buffer.readUInt8(1);
if (hint_type = 3) {
client.last_hint_msg = buffer;
}
}
if (ygopro.constants.MSG[msg] === 'NEW_TURN') {
if (client.pos === 0) {
room.turn = room.turn + 1;
......@@ -2331,10 +2334,16 @@
return;
}
client.reconnecting = false;
if (client.last_game_msg && client.last_game_msg_title !== 'WAITING') {
if (!client.last_game_msg) {
return true;
}
if (client.last_game_msg_title !== 'WAITING') {
setTimeout(function() {
if (client.last_hint_msg) {
ygopro.stoc_send(client, 'GAME_MSG', client.last_hint_msg);
}
ygopro.stoc_send(client, 'GAME_MSG', client.last_game_msg);
}, 200);
}, 50);
}
return true;
});
......
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