Commit cb52892f authored by nanahira's avatar nanahira

add banned_room_params

parent ee3894fb
Pipeline #37730 passed with stages
in 10 minutes and 55 seconds
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
"KR": "ko-kr" "KR": "ko-kr"
} }
}, },
"banned_room_params": [],
"tips": { "tips": {
"enabled": true, "enabled": true,
"split_zh": false, "split_zh": false,
......
...@@ -1365,6 +1365,11 @@ class Room ...@@ -1365,6 +1365,11 @@ class Room
else if ((param = name.match /(.+)#/) != null) else if ((param = name.match /(.+)#/) != null)
rule = param[1].toUpperCase() rule = param[1].toUpperCase()
for banned_param in settings.modules.banned_room_params
rule = rule.replace(new RegExp("(,|,)#{banned_param}(,|,)", 'g'), ',')
rule = rule.replace(new RegExp("^#{banned_param}(,|,)", 'g'), '')
rule = rule.replace(new RegExp("(,|,)#{banned_param}$", 'g'), '')
rule = rule.replace(new RegExp("^#{banned_param}$", 'g'), '')
if (rule.match /(^|,|,)(M|MATCH)(,|,|$)/) if (rule.match /(^|,|,)(M|MATCH)(,|,|$)/)
@hostinfo.mode = 1 @hostinfo.mode = 1
......
...@@ -1726,7 +1726,7 @@ ...@@ -1726,7 +1726,7 @@
Room = class Room { Room = class Room {
constructor(name, hostinfo) { constructor(name, hostinfo) {
var death_time, draw_count, duel_rule, extra_mode_func, lflist, param, rule, start_hand, start_lp, time_limit; var banned_param, death_time, draw_count, duel_rule, extra_mode_func, j, len, lflist, param, ref, rule, start_hand, start_lp, time_limit;
this.hostinfo = hostinfo; this.hostinfo = hostinfo;
this.name = name; this.name = name;
//@alive = true //@alive = true
...@@ -1782,6 +1782,14 @@ ...@@ -1782,6 +1782,14 @@
this.hostinfo.draw_count = parseInt(param[8]); this.hostinfo.draw_count = parseInt(param[8]);
} else if ((param = name.match(/(.+)#/)) !== null) { } else if ((param = name.match(/(.+)#/)) !== null) {
rule = param[1].toUpperCase(); rule = param[1].toUpperCase();
ref = settings.modules.banned_room_params;
for (j = 0, len = ref.length; j < len; j++) {
banned_param = ref[j];
rule = rule.replace(new RegExp(`(,|,)${banned_param}(,|,)`, 'g'), ',');
rule = rule.replace(new RegExp(`^${banned_param}(,|,)`, 'g'), '');
rule = rule.replace(new RegExp(`(,|,)${banned_param}$`, 'g'), '');
rule = rule.replace(new RegExp(`^${banned_param}$`, 'g'), '');
}
if (rule.match(/(^|,|,)(M|MATCH)(,|,|$)/)) { if (rule.match(/(^|,|,)(M|MATCH)(,|,|$)/)) {
this.hostinfo.mode = 1; this.hostinfo.mode = 1;
} }
......
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