Commit bb22aa46 authored by mercury233's avatar mercury233

fix

parent 91a665a5
...@@ -459,7 +459,7 @@ ygopro.stoc_follow 'TYPE_CHANGE', false, (buffer, info, client, server)-> ...@@ -459,7 +459,7 @@ ygopro.stoc_follow 'TYPE_CHANGE', false, (buffer, info, client, server)->
return return
ygopro.stoc_follow 'HS_PLAYER_CHANGE', false, (buffer, info, client, server)-> ygopro.stoc_follow 'HS_PLAYER_CHANGE', false, (buffer, info, client, server)->
return unless client.room and client.room.max_player return unless client.room and client.room.max_player and client.is_host
pos = info.status >> 4; pos = info.status >> 4;
is_ready = (info.status & 0xf) == 9; is_ready = (info.status & 0xf) == 9;
if pos < client.room.max_player if pos < client.room.max_player
...@@ -469,7 +469,7 @@ ygopro.stoc_follow 'HS_PLAYER_CHANGE', false, (buffer, info, client, server)-> ...@@ -469,7 +469,7 @@ ygopro.stoc_follow 'HS_PLAYER_CHANGE', false, (buffer, info, client, server)->
player.is_ready = is_ready player.is_ready = is_ready
unless player.is_host unless player.is_host
client.room.ready_player_count_without_host+=player.is_ready client.room.ready_player_count_without_host+=player.is_ready
if client.is_host and client.room.ready_player_count_without_host >= client.room.max_player - 1 if client.room.ready_player_count_without_host >= client.room.max_player - 1
#log.info "all ready" #log.info "all ready"
setTimeout (()->wait_room_start(client.room,20);return), 1000 setTimeout (()->wait_room_start(client.room,20);return), 1000
return return
...@@ -479,13 +479,13 @@ wait_room_start = (room,time)-> ...@@ -479,13 +479,13 @@ wait_room_start = (room,time)->
time-=1 time-=1
if time if time
unless time % 5 unless time % 5
ygopro.stoc_send_chat_to_room room, "#{if time <= 9 then ' ' else ''}#{time}秒后若房主不开始游戏将被请出房间", if time <= 9 then 11 else 8 ygopro.stoc_send_chat_to_room room, "#{if time <= 9 then ' ' else ''}#{time}秒后房主若不开始游戏将被请出房间", if time <= 9 then 11 else 8
setTimeout (()->wait_room_start(room,time);return), 1000 setTimeout (()->wait_room_start(room,time);return), 1000
else else
for player in room.players for player in room.players
if player.is_host if player.is_host
Room.ban_player(player.name, player.ip, "挂机") Room.ban_player(player.name, player.ip, "挂机")
ygopro.stoc_send_chat_to_room room, "#{player.name} 被请出了房间", 11 ygopro.stoc_send_chat_to_room room, "#{player.name}系统请出了房间", 11
player.end() player.end()
return return
......
...@@ -509,7 +509,7 @@ ...@@ -509,7 +509,7 @@
ygopro.stoc_follow('HS_PLAYER_CHANGE', false, function(buffer, info, client, server) { ygopro.stoc_follow('HS_PLAYER_CHANGE', false, function(buffer, info, client, server) {
var is_ready, k, len, player, pos, ref; var is_ready, k, len, player, pos, ref;
if (!(client.room && client.room.max_player)) { if (!(client.room && client.room.max_player && client.is_host)) {
return; return;
} }
pos = info.status >> 4; pos = info.status >> 4;
...@@ -526,7 +526,7 @@ ...@@ -526,7 +526,7 @@
client.room.ready_player_count_without_host += player.is_ready; client.room.ready_player_count_without_host += player.is_ready;
} }
} }
if (client.is_host && client.room.ready_player_count_without_host >= client.room.max_player - 1) { if (client.room.ready_player_count_without_host >= client.room.max_player - 1) {
setTimeout((function() { setTimeout((function() {
wait_room_start(client.room, 20); wait_room_start(client.room, 20);
}), 1000); }), 1000);
...@@ -540,7 +540,7 @@ ...@@ -540,7 +540,7 @@
time -= 1; time -= 1;
if (time) { if (time) {
if (!(time % 5)) { if (!(time % 5)) {
ygopro.stoc_send_chat_to_room(room, "" + (time <= 9 ? ' ' : '') + time + "秒后若房主不开始游戏将被请出房间", time <= 9 ? 11 : 8); ygopro.stoc_send_chat_to_room(room, "" + (time <= 9 ? ' ' : '') + time + "秒后房主若不开始游戏将被请出房间", time <= 9 ? 11 : 8);
} }
setTimeout((function() { setTimeout((function() {
wait_room_start(room, time); wait_room_start(room, time);
...@@ -551,7 +551,7 @@ ...@@ -551,7 +551,7 @@
player = ref[k]; player = ref[k];
if (player.is_host) { if (player.is_host) {
Room.ban_player(player.name, player.ip, "挂机"); Room.ban_player(player.name, player.ip, "挂机");
ygopro.stoc_send_chat_to_room(room, player.name + " 被请出了房间", 11); ygopro.stoc_send_chat_to_room(room, player.name + "系统请出了房间", 11);
player.end(); player.end();
} }
} }
......
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