Commit dca20f60 authored by mercury233's avatar mercury233

fix

parent bb22aa46
...@@ -82,7 +82,7 @@ class Room ...@@ -82,7 +82,7 @@ class Room
return {"error":"因为您近期在游戏中#{bannedplayer.reason},您已被禁止使用随机对战功能,将在#{moment(bannedplayer.time).fromNow(true)}后解封"} return {"error":"因为您近期在游戏中#{bannedplayer.reason},您已被禁止使用随机对战功能,将在#{moment(bannedplayer.time).fromNow(true)}后解封"}
max_player = if type == 'T' then 4 else 2 max_player = if type == 'T' then 4 else 2
result = _.find @all, (room)-> result = _.find @all, (room)->
room.random_type != '' and !room.started and ((type == '' and room.random_type != 'T') or room.random_type == type) and room.get_playing_player().length < max_player and room.get_host().remoteAddress != Room.players_oppentlist[player_ip] room.random_type != '' and !room.started and ((type == '' and room.random_type != 'T') or room.random_type == type) and room.get_playing_player().length < max_player and (room.get_host()==null or room.get_host().remoteAddress != Room.players_oppentlist[player_ip])
if result if result
result.welcome = '对手已经在等你了,开始决斗吧!' result.welcome = '对手已经在等你了,开始决斗吧!'
#log.info 'found room', player_name #log.info 'found room', player_name
......
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
} }
max_player = type === 'T' ? 4 : 2; max_player = type === 'T' ? 4 : 2;
result = _.find(this.all, function(room) { result = _.find(this.all, function(room) {
return room.random_type !== '' && !room.started && ((type === '' && room.random_type !== 'T') || room.random_type === type) && room.get_playing_player().length < max_player && room.get_host().remoteAddress !== Room.players_oppentlist[player_ip]; return room.random_type !== '' && !room.started && ((type === '' && room.random_type !== 'T') || room.random_type === type) && room.get_playing_player().length < max_player && (room.get_host() === null || room.get_host().remoteAddress !== Room.players_oppentlist[player_ip]);
}); });
if (result) { if (result) {
result.welcome = '对手已经在等你了,开始决斗吧!'; result.welcome = '对手已经在等你了,开始决斗吧!';
......
...@@ -499,7 +499,7 @@ ygopro.stoc_send_random_tip_to_room = (room)-> ...@@ -499,7 +499,7 @@ ygopro.stoc_send_random_tip_to_room = (room)->
setInterval ()-> setInterval ()->
for room in Room.all for room in Room.all
ygopro.stoc_send_random_tip_to_room(room) unless room.started ygopro.stoc_send_random_tip_to_room(room) unless room and room.started
return return
, 30000 , 30000
......
...@@ -576,7 +576,7 @@ ...@@ -576,7 +576,7 @@
ref = Room.all; ref = Room.all;
for (k = 0, len = ref.length; k < len; k++) { for (k = 0, len = ref.length; k < len; k++) {
room = ref[k]; room = ref[k];
if (!room.started) { if (!(room && room.started)) {
ygopro.stoc_send_random_tip_to_room(room); ygopro.stoc_send_random_tip_to_room(room);
} }
} }
......
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