Commit b06297ba authored by nanahira's avatar nanahira

play words in watching

parent 77d3151d
...@@ -1754,6 +1754,12 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1754,6 +1754,12 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client.setTimeout(300000) #连接后超时5分钟 client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room) client.rid = _.indexOf(ROOM_all, room)
client.is_post_watcher = true client.is_post_watcher = true
if settings.modules.vip.enabled and client.vip and vip_info.players[client.name].words
for line in _.lines vip_info.players[client.name].words
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK)
else if settings.modules.words.enabled and words.words[client.name]
for line in _.lines words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK)
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}") ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
room.watchers.push client room.watchers.push client
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
...@@ -1874,6 +1880,12 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1874,6 +1880,12 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
#client.setTimeout(300000) #连接后超时5分钟 #client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room) client.rid = _.indexOf(ROOM_all, room)
client.is_post_watcher = true client.is_post_watcher = true
if settings.modules.vip.enabled and client.vip and vip_info.players[client.name].words
for line in _.lines vip_info.players[client.name].words
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK)
else if settings.modules.words.enabled and words.words[client.name]
for line in _.lines words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK)
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}") ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
room.watchers.push client room.watchers.push client
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
...@@ -1957,6 +1969,12 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1957,6 +1969,12 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client.setTimeout(300000) #连接后超时5分钟 client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room) client.rid = _.indexOf(ROOM_all, room)
client.is_post_watcher = true client.is_post_watcher = true
if settings.modules.vip.enabled and client.vip and vip_info.players[client.name].words
for line in _.lines vip_info.players[client.name].words
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK)
else if settings.modules.words.enabled and words.words[client.name]
for line in _.lines words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK)
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}") ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
room.watchers.push client room.watchers.push client
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
......
...@@ -2006,7 +2006,7 @@ ...@@ -2006,7 +2006,7 @@
}); });
ygopro.ctos_follow('JOIN_GAME', false, function(buffer, info, client, server) { ygopro.ctos_follow('JOIN_GAME', false, function(buffer, info, client, server) {
var check, decrypted_buffer, finish, i, id, len2, len3, len4, m, n, name, o, pre_room, ref3, ref4, ref5, replay_id, room, secret; var check, decrypted_buffer, finish, i, id, len2, len3, len4, len5, len6, line, m, n, name, o, p, pre_room, q, ref3, ref4, ref5, ref6, ref7, replay_id, room, secret;
info.pass = info.pass.trim(); info.pass = info.pass.trim();
client.pass = info.pass; client.pass = info.pass;
if (CLIENT_is_able_to_reconnect(client) || CLIENT_is_able_to_kick_reconnect(client)) { if (CLIENT_is_able_to_reconnect(client) || CLIENT_is_able_to_kick_reconnect(client)) {
...@@ -2088,7 +2088,7 @@ ...@@ -2088,7 +2088,7 @@
return (checksum & 0xFF) === 0; return (checksum & 0xFF) === 0;
}; };
finish = function(buffer) { finish = function(buffer) {
var action, len2, m, name, opt1, opt2, opt3, options, ref3, room, title; var action, len2, len3, len4, line, m, n, name, o, opt1, opt2, opt3, options, ref3, ref4, ref5, room, title;
if (client.closed) { if (client.closed) {
return; return;
} }
...@@ -2169,12 +2169,25 @@ ...@@ -2169,12 +2169,25 @@
client.setTimeout(300000); client.setTimeout(300000);
client.rid = _.indexOf(ROOM_all, room); client.rid = _.indexOf(ROOM_all, room);
client.is_post_watcher = true; client.is_post_watcher = true;
if (settings.modules.vip.enabled && client.vip && vip_info.players[client.name].words) {
ref3 = _.lines(vip_info.players[client.name].words);
for (m = 0, len2 = ref3.length; m < len2; m++) {
line = ref3[m];
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK);
}
} else if (settings.modules.words.enabled && words.words[client.name]) {
ref4 = _.lines(words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]);
for (n = 0, len3 = ref4.length; n < len3; n++) {
line = ref4[n];
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK);
}
}
ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}"); ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}");
room.watchers.push(client); room.watchers.push(client);
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE);
ref3 = room.watcher_buffers; ref5 = room.watcher_buffers;
for (m = 0, len2 = ref3.length; m < len2; m++) { for (o = 0, len4 = ref5.length; o < len4; o++) {
buffer = ref3[m]; buffer = ref5[o];
client.write(buffer); client.write(buffer);
} }
} else { } else {
...@@ -2278,7 +2291,7 @@ ...@@ -2278,7 +2291,7 @@
challonge.matches._index({ challonge.matches._index({
id: settings.modules.challonge.tournament_id, id: settings.modules.challonge.tournament_id,
callback: function(err, data) { callback: function(err, data) {
var len4, len5, match, o, p, player, ref5, ref6; var len4, len5, len6, len7, line, match, o, p, player, q, r, ref5, ref6, ref7, ref8;
if (client.closed) { if (client.closed) {
return; return;
} }
...@@ -2314,12 +2327,25 @@ ...@@ -2314,12 +2327,25 @@
if (settings.modules.cloud_replay.enable_halfway_watch && !room.no_watch) { if (settings.modules.cloud_replay.enable_halfway_watch && !room.no_watch) {
client.rid = _.indexOf(ROOM_all, room); client.rid = _.indexOf(ROOM_all, room);
client.is_post_watcher = true; client.is_post_watcher = true;
if (settings.modules.vip.enabled && client.vip && vip_info.players[client.name].words) {
ref5 = _.lines(vip_info.players[client.name].words);
for (o = 0, len4 = ref5.length; o < len4; o++) {
line = ref5[o];
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK);
}
} else if (settings.modules.words.enabled && words.words[client.name]) {
ref6 = _.lines(words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]);
for (p = 0, len5 = ref6.length; p < len5; p++) {
line = ref6[p];
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK);
}
}
ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}"); ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}");
room.watchers.push(client); room.watchers.push(client);
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE);
ref5 = room.watcher_buffers; ref7 = room.watcher_buffers;
for (o = 0, len4 = ref5.length; o < len4; o++) { for (q = 0, len6 = ref7.length; q < len6; q++) {
buffer = ref5[o]; buffer = ref7[q];
client.write(buffer); client.write(buffer);
} }
} else { } else {
...@@ -2328,9 +2354,9 @@ ...@@ -2328,9 +2354,9 @@
} 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 {
ref6 = room.get_playing_player(); ref8 = room.get_playing_player();
for (p = 0, len5 = ref6.length; p < len5; p++) { for (r = 0, len7 = ref8.length; r < len7; r++) {
player = ref6[p]; player = ref8[r];
if (!(player && player !== client && player.challonge_info.id === client.challonge_info.id)) { if (!(player && player !== client && player.challonge_info.id === client.challonge_info.id)) {
continue; continue;
} }
...@@ -2392,12 +2418,25 @@ ...@@ -2392,12 +2418,25 @@
client.setTimeout(300000); client.setTimeout(300000);
client.rid = _.indexOf(ROOM_all, room); client.rid = _.indexOf(ROOM_all, room);
client.is_post_watcher = true; client.is_post_watcher = true;
if (settings.modules.vip.enabled && client.vip && vip_info.players[client.name].words) {
ref5 = _.lines(vip_info.players[client.name].words);
for (o = 0, len4 = ref5.length; o < len4; o++) {
line = ref5[o];
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK);
}
} else if (settings.modules.words.enabled && words.words[client.name]) {
ref6 = _.lines(words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]);
for (p = 0, len5 = ref6.length; p < len5; p++) {
line = ref6[p];
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK);
}
}
ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}"); ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}");
room.watchers.push(client); room.watchers.push(client);
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE);
ref5 = room.watcher_buffers; ref7 = room.watcher_buffers;
for (o = 0, len4 = ref5.length; o < len4; o++) { for (q = 0, len6 = ref7.length; q < len6; q++) {
buffer = ref5[o]; buffer = ref7[q];
client.write(buffer); client.write(buffer);
} }
} else { } else {
......
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