Commit a0b5faaf authored by nanahira's avatar nanahira

update challonge

parent 7d006e5f
...@@ -1688,6 +1688,8 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1688,6 +1688,8 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
challonge.participants._index({ challonge.participants._index({
id: settings.modules.challonge.tournament_id, id: settings.modules.challonge.tournament_id,
callback: (err, data) -> callback: (err, data) ->
if client.closed
return
if err or !data if err or !data
if err if err
log.warn("Failed loading Challonge user info", err) log.warn("Failed loading Challonge user info", err)
...@@ -1695,7 +1697,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1695,7 +1697,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
return return
found = false found = false
for k,user of data for k,user of data
if user.participant and user.participant.name == client.name if user.participant and user.participant.name and _.endsWith(user.participant.name, client.name)
found = user.participant found = user.participant
break break
if !found if !found
...@@ -1747,7 +1749,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1747,7 +1749,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
else if room.no_watch and room.players.length >= (if room.hostinfo.mode == 2 then 4 else 2) else if room.no_watch and room.players.length >= (if room.hostinfo.mode == 2 then 4 else 2)
ygopro.stoc_die(client, "${watch_denied_room}") ygopro.stoc_die(client, "${watch_denied_room}")
else else
for player in room.players when player and player != client and player.name == client.name for player in room.get_playing_player() when player and player != client and player.challonge_info.id == client.challonge_info.id
ygopro.stoc_die(client, "${challonge_player_already_in}") ygopro.stoc_die(client, "${challonge_player_already_in}")
return return
#client.room = room #client.room = room
......
...@@ -2068,6 +2068,9 @@ ...@@ -2068,6 +2068,9 @@
id: settings.modules.challonge.tournament_id, id: settings.modules.challonge.tournament_id,
callback: function(err, data) { callback: function(err, data) {
var found, k, user; var found, k, user;
if (client.closed) {
return;
}
if (err || !data) { if (err || !data) {
if (err) { if (err) {
log.warn("Failed loading Challonge user info", err); log.warn("Failed loading Challonge user info", err);
...@@ -2078,7 +2081,7 @@ ...@@ -2078,7 +2081,7 @@
found = false; found = false;
for (k in data) { for (k in data) {
user = data[k]; user = data[k];
if (user.participant && user.participant.name === client.name) { if (user.participant && user.participant.name && _.endsWith(user.participant.name, client.name)) {
found = user.participant; found = user.participant;
break; break;
} }
...@@ -2142,10 +2145,10 @@ ...@@ -2142,10 +2145,10 @@
} else if (room.no_watch && room.players.length >= (room.hostinfo.mode === 2 ? 4 : 2)) { } else if (room.no_watch && room.players.length >= (room.hostinfo.mode === 2 ? 4 : 2)) {
ygopro.stoc_die(client, "${watch_denied_room}"); ygopro.stoc_die(client, "${watch_denied_room}");
} else { } else {
ref5 = room.players; ref5 = room.get_playing_player();
for (p = 0, len5 = ref5.length; p < len5; p++) { for (p = 0, len5 = ref5.length; p < len5; p++) {
player = ref5[p]; player = ref5[p];
if (!(player && player !== client && player.name === client.name)) { if (!(player && player !== client && player.challonge_info.id === client.challonge_info.id)) {
continue; continue;
} }
ygopro.stoc_die(client, "${challonge_player_already_in}"); ygopro.stoc_die(client, "${challonge_player_already_in}");
......
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