Commit e12b29de authored by mercury233's avatar mercury233

add send tip to prevent lose connection

parent 3603b6ad
......@@ -451,6 +451,15 @@ ygopro.stoc_follow 'TYPE_CHANGE', false, (buffer, info, client, server)->
ygopro.stoc_send_random_tip = (client)->
ygopro.stoc_send_chat client, "Tip: " + tips[Math.floor(Math.random() * tips.length)] if tips
return
ygopro.stoc_send_random_tip_to_room = (room)->
ygopro.stoc_send_chat_to_room room, "Tip: " + tips[Math.floor(Math.random() * tips.length)] if tips
return
setInterval ()->
for room in Room.all
ygopro.stoc_send_random_tip_to_room(room) unless room.started
return
, 30000
tips = null
if settings.modules.tips
......
......@@ -494,6 +494,23 @@
}
};
ygopro.stoc_send_random_tip_to_room = function(room) {
if (tips) {
ygopro.stoc_send_chat_to_room(room, "Tip: " + tips[Math.floor(Math.random() * tips.length)]);
}
};
setInterval(function() {
var k, len, ref, room;
ref = Room.all;
for (k = 0, len = ref.length; k < len; k++) {
room = ref[k];
if (!room.started) {
ygopro.stoc_send_random_tip_to_room(room);
}
}
}, 30000);
tips = null;
if (settings.modules.tips) {
......
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