Commit 969acf07 authored by nanahira's avatar nanahira

protect quitting after 30 sec

parent cee56068
...@@ -156,6 +156,8 @@ ...@@ -156,6 +156,8 @@
"replay_hint_part1": "Sending the replay of the duel number ", "replay_hint_part1": "Sending the replay of the duel number ",
"replay_hint_part2": ".", "replay_hint_part2": ".",
"invalid_side_rule": "Illegal cards are contained in your side deck.", "invalid_side_rule": "Illegal cards are contained in your side deck.",
"arena_wait_hint": "If you opponent does not appear within 25 seconds, you may quit without any penalty.",
"arena_wait_timeout": "Your opponent did not appear, you may quit without any penalty.",
"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": {
...@@ -459,6 +461,8 @@ ...@@ -459,6 +461,8 @@
"replay_hint_part1": "正在发送第", "replay_hint_part1": "正在发送第",
"replay_hint_part2": "局决斗的录像。", "replay_hint_part2": "局决斗的录像。",
"invalid_side_rule": "副卡组中包含不允许换入副卡组的卡。", "invalid_side_rule": "副卡组中包含不允许换入副卡组的卡。",
"arena_wait_hint": "若对手在25秒内不进入游戏,您退房时不会进行扣分。",
"arena_wait_timeout": "由于对手未能在30秒内进入游戏,此时您退出游戏不会扣分。",
"athletic_arena_tip": "在竞技匹配中,比赛开始前退出游戏也会视为投降。" "athletic_arena_tip": "在竞技匹配中,比赛开始前退出游戏也会视为投降。"
}, },
"ko-kr": { "ko-kr": {
......
...@@ -70,6 +70,8 @@ import_datas = [ ...@@ -70,6 +70,8 @@ import_datas = [
"start_deckbuf", "start_deckbuf",
"challonge_info", "challonge_info",
"ready_trap", "ready_trap",
"join_time",
"arena_quit_free",
"replays_sent" "replays_sent"
] ]
...@@ -1286,6 +1288,7 @@ class Room ...@@ -1286,6 +1288,7 @@ class Room
connect: (client)-> connect: (client)->
@players.push client @players.push client
client.join_time = moment()
if @random_type if @random_type
client.abuse_count = 0 client.abuse_count = 0
host_player = @get_host() host_player = @get_host()
...@@ -1317,7 +1320,7 @@ class Room ...@@ -1317,7 +1320,7 @@ class Room
client.server.destroy() client.server.destroy()
else else
#log.info(client.name, @started, @disconnector, @random_type, @players.length) #log.info(client.name, @started, @disconnector, @random_type, @players.length)
if @arena and !@started and @disconnector != 'server' and !@arena_score_handled if @arena and !@started and @disconnector != 'server' and !@arena_score_handled and !client.arena_quit_free
for player in @players when player.pos != 7 for player in @players when player.pos != 7
@scores[player.name_vpass] = 0 @scores[player.name_vpass] = 0
if @players.length == 2 if @players.length == 2
...@@ -3203,6 +3206,15 @@ if settings.modules.mycard.enabled ...@@ -3203,6 +3206,15 @@ if settings.modules.mycard.enabled
CLIENT_kick(room.waiting_for_player) CLIENT_kick(room.waiting_for_player)
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} ${afk_warn_part1}#{settings.modules.random_duel.hang_timeout - time_passed}${afk_warn_part2}", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{room.waiting_for_player.name} ${afk_warn_part1}#{settings.modules.random_duel.hang_timeout - time_passed}${afk_warn_part2}", ygopro.constants.COLORS.RED)
for room in ROOM_all when room and room.arena and !room.started and room.get_playing_player().length < 2
player = room.get_playing_player()[0]
if player and !player.arena_quit_free
waited_time = moment() - player.join_time
if waited_time >= 30000
ygopro.stoc_send_chat(player, "${arena_wait_timeout}", ygopro.constants.COLORS.BABYBLUE)
player.arena_quit_free = true
else if waited_time >= 5000 and waited_time < 6000
ygopro.stoc_send_chat(player, "${arena_wait_hint}", ygopro.constants.COLORS.BABYBLUE)
return return
, 1000 , 1000
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
} }
}); });
import_datas = ["abuse_count", "ban_mc", "vpass", "rag", "rid", "is_post_watcher", "retry_count", "name", "pass", "name_vpass", "is_first", "lp", "card_count", "is_host", "pos", "surrend_confirm", "kick_count", "deck_saved", "main", "side", "side_interval", "side_tcount", "selected_preduel", "last_game_msg", "last_game_msg_title", "last_hint_msg", "start_deckbuf", "challonge_info", "ready_trap", "replays_sent"]; import_datas = ["abuse_count", "ban_mc", "vpass", "rag", "rid", "is_post_watcher", "retry_count", "name", "pass", "name_vpass", "is_first", "lp", "card_count", "is_host", "pos", "surrend_confirm", "kick_count", "deck_saved", "main", "side", "side_interval", "side_tcount", "selected_preduel", "last_game_msg", "last_game_msg_title", "last_hint_msg", "start_deckbuf", "challonge_info", "ready_trap", "join_time", "arena_quit_free", "replays_sent"];
merge = require('deepmerge'); merge = require('deepmerge');
...@@ -1671,6 +1671,7 @@ ...@@ -1671,6 +1671,7 @@
Room.prototype.connect = function(client) { Room.prototype.connect = function(client) {
var host_player; var host_player;
this.players.push(client); this.players.push(client);
client.join_time = moment();
if (this.random_type) { if (this.random_type) {
client.abuse_count = 0; client.abuse_count = 0;
host_player = this.get_host(); host_player = this.get_host();
...@@ -1711,7 +1712,7 @@ ...@@ -1711,7 +1712,7 @@
} }
client.server.destroy(); client.server.destroy();
} else { } else {
if (this.arena && !this.started && this.disconnector !== 'server' && !this.arena_score_handled) { if (this.arena && !this.started && this.disconnector !== 'server' && !this.arena_score_handled && !client.arena_quit_free) {
ref2 = this.players; ref2 = this.players;
for (m = 0, len2 = ref2.length; m < len2; m++) { for (m = 0, len2 = ref2.length; m < len2; m++) {
player = ref2[m]; player = ref2[m];
...@@ -4091,7 +4092,7 @@ ...@@ -4091,7 +4092,7 @@
if (settings.modules.mycard.enabled) { if (settings.modules.mycard.enabled) {
setInterval(function() { setInterval(function() {
var len2, m, room, time_passed; var len2, len3, m, n, player, room, time_passed, waited_time;
for (m = 0, len2 = ROOM_all.length; m < len2; m++) { for (m = 0, len2 = ROOM_all.length; m < len2; m++) {
room = ROOM_all[m]; room = ROOM_all[m];
if (!(room && room.started && room.arena && room.last_active_time && room.waiting_for_player && room.get_disconnected_count() === 0)) { if (!(room && room.started && room.arena && room.last_active_time && room.waiting_for_player && room.get_disconnected_count() === 0)) {
...@@ -4108,6 +4109,22 @@ ...@@ -4108,6 +4109,22 @@
ygopro.stoc_send_chat_to_room(room, room.waiting_for_player.name + " ${afk_warn_part1}" + (settings.modules.random_duel.hang_timeout - time_passed) + "${afk_warn_part2}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, room.waiting_for_player.name + " ${afk_warn_part1}" + (settings.modules.random_duel.hang_timeout - time_passed) + "${afk_warn_part2}", ygopro.constants.COLORS.RED);
} }
} }
for (n = 0, len3 = ROOM_all.length; n < len3; n++) {
room = ROOM_all[n];
if (!(room && room.arena && !room.started && room.get_playing_player().length < 2)) {
continue;
}
player = room.get_playing_player()[0];
if (player && !player.arena_quit_free) {
waited_time = moment() - player.join_time;
if (waited_time >= 30000) {
ygopro.stoc_send_chat(player, "${arena_wait_timeout}", ygopro.constants.COLORS.BABYBLUE);
player.arena_quit_free = true;
} else if (waited_time >= 5000 && waited_time < 6000) {
ygopro.stoc_send_chat(player, "${arena_wait_hint}", ygopro.constants.COLORS.BABYBLUE);
}
}
}
}, 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