Commit ed52f897 authored by nanahira's avatar nanahira

add reconnect

parent 5c4550cb
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
"34": "HS_READY", "34": "HS_READY",
"35": "HS_NOTREADY", "35": "HS_NOTREADY",
"36": "HS_KICK", "36": "HS_KICK",
"37": "HS_START" "37": "HS_START",
"48": "REQUEST_FIELD"
}, },
"STOC": { "STOC": {
"1": "GAME_MSG", "1": "GAME_MSG",
...@@ -51,7 +52,8 @@ ...@@ -51,7 +52,8 @@
"25": "CHAT", "25": "CHAT",
"32": "HS_PLAYER_ENTER", "32": "HS_PLAYER_ENTER",
"33": "HS_PLAYER_CHANGE", "33": "HS_PLAYER_CHANGE",
"34": "HS_WATCH_CHANGE" "34": "HS_WATCH_CHANGE",
"48": "FIELD_FINISH"
}, },
"PLAYERCHANGE":{ "PLAYERCHANGE":{
"8": "OBSERVE", "8": "OBSERVE",
......
...@@ -86,6 +86,10 @@ ...@@ -86,6 +86,10 @@
"enabled": true, "enabled": true,
"max_retry_count": false "max_retry_count": false
}, },
"reconnect": {
"enabled": true,
"wait_time": 300000
},
"mycard": { "mycard": {
"enabled": false, "enabled": false,
"auth_base_url": "https://ygobbs.com", "auth_base_url": "https://ygobbs.com",
......
...@@ -131,6 +131,10 @@ ...@@ -131,6 +131,10 @@
"retry_too_much_part2": " times.", "retry_too_much_part2": " times.",
"retry_too_much_room_part1": " was kicked from the room for performing an illegal operation ", "retry_too_much_room_part1": " was kicked from the room for performing an illegal operation ",
"retry_too_much_room_part2": " times.", "retry_too_much_room_part2": " times.",
"pre_reconnecting_to_room": "You will be reconnected to your previous game. Please pick your Previous deck.",
"deck_incorrect_reconnect": "Please pick your Previous deck.",
"reconnect_failed": "Reconnect failed.",
"reconnecting_to_room": "Reconnecting to server...",
"athletic_arena_tip": "During an athletic match, a game quit behavior is regarded as a surrender." "athletic_arena_tip": "During an athletic match, a game quit behavior is regarded as a surrender."
}, },
"es-es": { "es-es": {
...@@ -398,6 +402,10 @@ ...@@ -398,6 +402,10 @@
"retry_too_much_part2": "次,已被请出房间。", "retry_too_much_part2": "次,已被请出房间。",
"retry_too_much_room_part1": " 由于在决斗中违规操作", "retry_too_much_room_part1": " 由于在决斗中违规操作",
"retry_too_much_room_part2": "次,已被请出房间。", "retry_too_much_room_part2": "次,已被请出房间。",
"pre_reconnecting_to_room": "你有未完成的对局,即将重新连接,请选择你在本局决斗中使用的卡组并准备。",
"deck_incorrect_reconnect": "请选择你在本局决斗中使用的卡组。",
"reconnect_failed": "重新连接失败。",
"reconnecting_to_room": "正在重新连接到服务器……",
"athletic_arena_tip": "在竞技匹配中,比赛开始前退出游戏也会视为投降。" "athletic_arena_tip": "在竞技匹配中,比赛开始前退出游戏也会视为投降。"
}, },
"ko-kr": { "ko-kr": {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{"name": "lflist", "type": "unsigned int"}, {"name": "lflist", "type": "unsigned int"},
{"name": "rule", "type": "unsigned char"}, {"name": "rule", "type": "unsigned char"},
{"name": "mode", "type": "unsigned char"}, {"name": "mode", "type": "unsigned char"},
{"name": "enable_priority", "type": "bool"}, {"name": "duel_rule", "type": "unsigned char"},
{"name": "no_check_deck", "type": "bool"}, {"name": "no_check_deck", "type": "bool"},
{"name": "no_shuffle_deck", "type": "bool"}, {"name": "no_shuffle_deck", "type": "bool"},
{"name": "start_lp", "type": "unsigned int"}, {"name": "start_lp", "type": "unsigned int"},
......
This diff is collapsed.
This diff is collapsed.
...@@ -60,6 +60,8 @@ for name, declaration of structs_declaration ...@@ -60,6 +60,8 @@ for name, declaration of structs_declaration
#消息发送函数,至少要把俩合起来.... #消息发送函数,至少要把俩合起来....
@stoc_send = (socket, proto, info)-> @stoc_send = (socket, proto, info)->
if socket.closed
return
#console.log proto, proto_structs.STOC[proto], structs[proto_structs.STOC[proto]] #console.log proto, proto_structs.STOC[proto], structs[proto_structs.STOC[proto]]
if typeof info == 'undefined' if typeof info == 'undefined'
buffer = "" buffer = ""
...@@ -86,6 +88,8 @@ for name, declaration of structs_declaration ...@@ -86,6 +88,8 @@ for name, declaration of structs_declaration
return return
@ctos_send = (socket, proto, info)-> @ctos_send = (socket, proto, info)->
if socket.closed
return
#console.log proto, proto_structs.CTOS[proto], structs[proto_structs.CTOS[proto]] #console.log proto, proto_structs.CTOS[proto], structs[proto_structs.CTOS[proto]]
if typeof info == 'undefined' if typeof info == 'undefined'
buffer = "" buffer = ""
...@@ -164,5 +168,7 @@ for name, declaration of structs_declaration ...@@ -164,5 +168,7 @@ for name, declaration of structs_declaration
msg: 1 msg: 1
code: 9 code: 9
} if client } if client
client.destroy() if client if client
client.system_kicked = true
client.destroy()
return return
\ No newline at end of file
...@@ -104,6 +104,9 @@ ...@@ -104,6 +104,9 @@
this.stoc_send = function(socket, proto, info) { this.stoc_send = function(socket, proto, info) {
var buffer, header, key, ref, struct, value; var buffer, header, key, ref, struct, value;
if (socket.closed) {
return;
}
if (typeof info === 'undefined') { if (typeof info === 'undefined') {
buffer = ""; buffer = "";
} else if (Buffer.isBuffer(info)) { } else if (Buffer.isBuffer(info)) {
...@@ -138,6 +141,9 @@ ...@@ -138,6 +141,9 @@
this.ctos_send = function(socket, proto, info) { this.ctos_send = function(socket, proto, info) {
var buffer, header, key, ref, struct, value; var buffer, header, key, ref, struct, value;
if (socket.closed) {
return;
}
if (typeof info === 'undefined') { if (typeof info === 'undefined') {
buffer = ""; buffer = "";
} else if (Buffer.isBuffer(info)) { } else if (Buffer.isBuffer(info)) {
...@@ -264,6 +270,7 @@ ...@@ -264,6 +270,7 @@
}); });
} }
if (client) { if (client) {
client.system_kicked = true;
client.destroy(); client.destroy();
} }
}; };
......
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