Commit d0155124 authored by nanahira's avatar nanahira

test

parent 4077e873
......@@ -142,6 +142,7 @@
"challonge_match_not_found": "Your current match was not found.",
"challonge_match_already_finished": "Your current match was already finished. Please call the judge for any help.",
"challonge_match_created": "A room for match only is created. Your opponent will join in automatically.",
"challonge_player_already_in": "Please do not enter the room you are already in.",
"athletic_arena_tip": "During an athletic match, a game quit behavior is regarded as a surrender."
},
"es-es": {
......@@ -424,6 +425,7 @@
"challonge_match_not_found": "你没有当前轮次的比赛。",
"challonge_match_already_finished": "你在当前轮次的比赛已经结束,如需重赛,请联系裁判。",
"challonge_match_created": "已建立比赛专用房间,将会自动匹配你的对手。",
"challonge_player_already_in": "请不要重复加入比赛房间。",
"athletic_arena_tip": "在竞技匹配中,比赛开始前退出游戏也会视为投降。"
},
"ko-kr": {
......
......@@ -453,7 +453,7 @@ release_disconnect = (dinfo, reconnected) ->
return
CLIENT_get_authorize_key = (client) ->
if settings.modules.mycard.enabled or settings.modules.tournament_mode.enabled or client.is_local
if settings.modules.mycard.enabled or settings.modules.tournament_mode.enabled or settings.modules.challonge.enabled or client.is_local
return client.name
else
return client.ip + ":" + client.name
......@@ -825,11 +825,11 @@ class Room
#else
# log.info 'SCORE POST OK', response.statusCode, response.statusMessage, @name, body
return
if settings.modules.challonge.enabled
if settings.modules.challonge.enabled and @started
challonge.matches.update({
id: settings.modules.challonge.tournament_id,
matchId: room.challonge_info.id,
match: room.challonge_duel_log,
matchId: @challonge_info.id,
match: @challonge_duel_log,
callback: (err, data) ->
if err
log.warn("Errored pushing scores to Challonge.", err)
......@@ -1480,22 +1480,21 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
challonge.participants.index({
id: settings.modules.challonge.tournament_id,
callback: (err, data) ->
log.info("user info", client.name, data)
if err or !data
if err
log.warn("Failed loading Challonge user info", err)
ygopro.stoc_die(client, '${challonge_match_load_failed}')
return
found = false
for user in data
if user.participant.name == client.name
for k,user of data
if user.participant and user.participant.name == client.name
found = user.participant
break
if !found
ygopro.stoc_die(client, '${challonge_user_not_found}')
return
client.challonge_info = found
challonge.participants.index({
challonge.matches.index({
id: settings.modules.challonge.tournament_id,
callback: (err, data) ->
if err or !data
......@@ -1504,10 +1503,10 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
ygopro.stoc_die(client, '${challonge_match_load_failed}')
return
found = false
for match in data
if data.match.player1_id == client.challonge_info.id or data.match.player2_id == client.challonge_info.id
found = data.match_list
break
for k,match of data
if match and match.match and (match.match.player1Id == client.challonge_info.id or match.match.player2Id == client.challonge_info.id)
found = match.match
break
if !found
ygopro.stoc_die(client, '${challonge_match_not_found}')
return
......@@ -1536,6 +1535,9 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
else
ygopro.stoc_die(client, "${watch_denied}")
else
for player in room.players when player and player != client and player.name == client.name
ygopro.stoc_die(client, "${challonge_player_already_in}")
return
#client.room = room
client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room)
......@@ -2515,9 +2517,9 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
room.challonge_duel_log.winnerId = room.dueling_players[1].challonge_info.id
else
room.challonge_duel_log.winnerId = "tie"
if room.challonge_duel_log.winnerId == room.challonge_info.player1_id
if room.challonge_duel_log.winnerId == room.challonge_info.player1Id
room.challonge_duel_log.scoresCsv = "1-0"
else if room.challonge_duel_log.winnerId == room.challonge_info.player2_id
else if room.challonge_duel_log.winnerId == room.challonge_info.player2Id
room.challonge_duel_log.scoresCsv = "0-1"
else
room.challonge_duel_log.scoresCsv = "0-0"
......
......@@ -586,7 +586,7 @@
};
CLIENT_get_authorize_key = function(client) {
if (settings.modules.mycard.enabled || settings.modules.tournament_mode.enabled || client.is_local) {
if (settings.modules.mycard.enabled || settings.modules.tournament_mode.enabled || settings.modules.challonge.enabled || client.is_local) {
return client.name;
} else {
return client.ip + ":" + client.name;
......@@ -1066,11 +1066,11 @@
})(this));
}
}
if (settings.modules.challonge.enabled) {
if (settings.modules.challonge.enabled && this.started) {
challonge.matches.update({
id: settings.modules.challonge.tournament_id,
matchId: room.challonge_info.id,
match: room.challonge_duel_log,
matchId: this.challonge_info.id,
match: this.challonge_duel_log,
callback: function(err, data) {
if (err) {
log.warn("Errored pushing scores to Challonge.", err);
......@@ -1808,8 +1808,7 @@
challonge.participants.index({
id: settings.modules.challonge.tournament_id,
callback: function(err, data) {
var found, len4, o, user;
log.info("user info", client.name, data);
var found, k, user;
if (err || !data) {
if (err) {
log.warn("Failed loading Challonge user info", err);
......@@ -1818,9 +1817,9 @@
return;
}
found = false;
for (o = 0, len4 = data.length; o < len4; o++) {
user = data[o];
if (user.participant.name === client.name) {
for (k in data) {
user = data[k];
if (user.participant && user.participant.name === client.name) {
found = user.participant;
break;
}
......@@ -1830,10 +1829,10 @@
return;
}
client.challonge_info = found;
challonge.participants.index({
challonge.matches.index({
id: settings.modules.challonge.tournament_id,
callback: function(err, data) {
var len5, len6, match, p, q, ref4;
var len4, len5, match, o, p, player, ref4, ref5;
if (err || !data) {
if (err) {
log.warn("Failed loading Challonge match info", err);
......@@ -1842,10 +1841,10 @@
return;
}
found = false;
for (p = 0, len5 = data.length; p < len5; p++) {
match = data[p];
if (data.match.player1_id === client.challonge_info.id || data.match.player2_id === client.challonge_info.id) {
found = data.match_list;
for (k in data) {
match = data[k];
if (match && match.match && (match.match.player1Id === client.challonge_info.id || match.match.player2Id === client.challonge_info.id)) {
found = match.match;
break;
}
}
......@@ -1876,14 +1875,23 @@
room.watchers.push(client);
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE);
ref4 = room.watcher_buffers;
for (q = 0, len6 = ref4.length; q < len6; q++) {
buffer = ref4[q];
for (o = 0, len4 = ref4.length; o < len4; o++) {
buffer = ref4[o];
client.write(buffer);
}
} else {
ygopro.stoc_die(client, "${watch_denied}");
}
} else {
ref5 = room.players;
for (p = 0, len5 = ref5.length; p < len5; p++) {
player = ref5[p];
if (!(player && player !== client && player.name === client.name)) {
continue;
}
ygopro.stoc_die(client, "${challonge_player_already_in}");
return;
}
client.setTimeout(300000);
client.rid = _.indexOf(ROOM_all, room);
room.connect(client);
......@@ -3167,9 +3175,9 @@
} else {
room.challonge_duel_log.winnerId = "tie";
}
if (room.challonge_duel_log.winnerId === room.challonge_info.player1_id) {
if (room.challonge_duel_log.winnerId === room.challonge_info.player1Id) {
room.challonge_duel_log.scoresCsv = "1-0";
} else if (room.challonge_duel_log.winnerId === room.challonge_info.player2_id) {
} else if (room.challonge_duel_log.winnerId === room.challonge_info.player2Id) {
room.challonge_duel_log.scoresCsv = "0-1";
} else {
room.challonge_duel_log.scoresCsv = "0-0";
......
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