Commit 5a2989b7 authored by mercury233's avatar mercury233

fix memory percentage, fix time limit (0=unlimited)

parent 6406988f
......@@ -100,7 +100,7 @@ class Room
else if (((param = name.match /(.+)#/) != null) and ( (param[1].length<=2 and param[1].match(/(S|N|M|T)(0|1|2|T|A)/i)) or (param[1].match(/^(S|N|M|T)(0|1|2|O|T|A)(0|1|O|T)/i)) ) )
rule=param[1].toUpperCase()
log.info "C", rule
#log.info "C", rule
switch rule.charAt(0)
when "M","1"
......@@ -125,7 +125,7 @@ class Room
else
@hostinfo.lflist = 0
if ((param = parseInt(rule.charAt(3).match(/\d/))) > 0)
if ((param = parseInt(rule.charAt(3).match(/\d/))) >= 0)
@hostinfo.time_limit=param*60
switch rule.charAt(4)
......@@ -157,7 +157,7 @@ class Room
else if ((param = name.match /(.+)#/) != null)
rule=param[1].toUpperCase()
log.info "233", rule
#log.info "233", rule
if (rule.match /(^|,|,)(M|MATCH)(,|,|$)/)
@hostinfo.mode = 1
......@@ -181,7 +181,7 @@ class Room
if (param = rule.match /(^|,|,)(TIME|TM|TI)(\d+)(,|,|$)/)
time_limit = parseInt(param[3])
if (time_limit <= 0) then time_limit = 180
if (time_limit < 0) then time_limit = 180
if (time_limit >= 1 and time_limit <= 60) then time_limit = time_limit*60
if (time_limit >= 999) then time_limit = 999
@hostinfo.time_limit = time_limit
......
......@@ -116,7 +116,6 @@
this.hostinfo.draw_count = parseInt(param[8]);
} else if (((param = name.match(/(.+)#/)) !== null) && ((param[1].length <= 2 && param[1].match(/(S|N|M|T)(0|1|2|T|A)/i)) || (param[1].match(/^(S|N|M|T)(0|1|2|O|T|A)(0|1|O|T)/i)))) {
rule = param[1].toUpperCase();
log.info("C", rule);
switch (rule.charAt(0)) {
case "M":
case "1":
......@@ -150,7 +149,7 @@
default:
this.hostinfo.lflist = 0;
}
if ((param = parseInt(rule.charAt(3).match(/\d/))) > 0) {
if ((param = parseInt(rule.charAt(3).match(/\d/))) >= 0) {
this.hostinfo.time_limit = param * 60;
}
switch (rule.charAt(4)) {
......@@ -188,7 +187,6 @@
}
} else if ((param = name.match(/(.+)#/)) !== null) {
rule = param[1].toUpperCase();
log.info("233", rule);
if (rule.match(/(^|,|,)(M|MATCH)(,|,|$)/)) {
this.hostinfo.mode = 1;
}
......@@ -215,7 +213,7 @@
}
if ((param = rule.match(/(^|,|,)(TIME|TM|TI)(\d+)(,|,|$)/))) {
time_limit = parseInt(param[3]);
if (time_limit <= 0) {
if (time_limit < 0) {
time_limit = 180;
}
if (time_limit >= 1 && time_limit <= 60) {
......
......@@ -289,8 +289,8 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
return unless client.room
if settings.modules.welcome
ygopro.stoc_send_chat client, settings.modules.welcome
if (os.freemem() / os.totalmem())<=0.1
ygopro.stoc_send_chat client, "服务器已经爆满,随时存在崩溃风险!"
##if (os.freemem() / os.totalmem())<=0.1
## ygopro.stoc_send_chat client, "服务器已经爆满,随时存在崩溃风险!"
if settings.modules.post_start_watching and !client.room.watcher
client.room.watcher = watcher = net.connect client.room.port, ->
......
......@@ -318,9 +318,6 @@
if (settings.modules.welcome) {
ygopro.stoc_send_chat(client, settings.modules.welcome);
}
if ((os.freemem() / os.totalmem()) <= 0.1) {
ygopro.stoc_send_chat(client, "服务器已经爆满,随时存在崩溃风险!");
}
if (settings.modules.post_start_watching && !client.room.watcher) {
client.room.watcher = watcher = net.connect(client.room.port, function() {
ygopro.ctos_send(watcher, 'PLAYER_INFO', {
......
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