Commit 1396cf30 authored by 神楽坂玲奈's avatar 神楽坂玲奈

auto lflist

parent 54869740
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
"enable_random_duel": false, "enable_random_duel": false,
"mycard_auth": "https://ygobbs.com", "mycard_auth": "https://ygobbs.com",
"post_start_watching": true, "post_start_watching": true,
"TCG_banlist_id": 8,
"enable_TCG_as_default": false, "enable_TCG_as_default": false,
"http": { "http": {
"port": 7922, "port": 7922,
......
This diff is collapsed.
...@@ -204,7 +204,9 @@ ...@@ -204,7 +204,9 @@
this.welcome = ''; this.welcome = '';
Room.all.push(this); Room.all.push(this);
this.hostinfo || (this.hostinfo = { this.hostinfo || (this.hostinfo = {
lflist: 0, lflist: function(list) {
return !list.tcg && list.date.isBefore();
},
rule: settings.modules.enable_TCG_as_default ? 2 : 0, rule: settings.modules.enable_TCG_as_default ? 2 : 0,
mode: 0, mode: 0,
enable_priority: false, enable_priority: false,
...@@ -259,10 +261,14 @@ ...@@ -259,10 +261,14 @@
switch (rule.charAt(2)) { switch (rule.charAt(2)) {
case "1": case "1":
case "T": case "T":
this.hostinfo.lflist = settings.modules.TCG_banlist_id; this.hostinfo.lflist = _.findIndex(settings.lflist, function(list) {
return list.tcg && list.date.isBefore();
});
break; break;
default: default:
this.hostinfo.lflist = 0; this.hostinfo.lflist = _.findIndex(settings.lflist, function(list) {
return !list.tcg && list.date.isBefore();
});
} }
if ((param = parseInt(rule.charAt(3).match(/\d/))) >= 0) { if ((param = parseInt(rule.charAt(3).match(/\d/))) >= 0) {
this.hostinfo.time_limit = param * 60; this.hostinfo.time_limit = param * 60;
...@@ -311,7 +317,9 @@ ...@@ -311,7 +317,9 @@
} }
if (rule.match(/(^|,|,)(TCGONLY|TO)(,|,|$)/)) { if (rule.match(/(^|,|,)(TCGONLY|TO)(,|,|$)/)) {
this.hostinfo.rule = 1; this.hostinfo.rule = 1;
this.hostinfo.lflist = settings.modules.TCG_banlist_id; this.hostinfo.lflist = _.findIndex(settings.lflist, function(list) {
return list.tcg && list.date.isBefore();
});
} }
if (rule.match(/(^|,|,)(OCGONLY|OO)(,|,|$)/)) { if (rule.match(/(^|,|,)(OCGONLY|OO)(,|,|$)/)) {
this.hostinfo.rule = 0; this.hostinfo.rule = 0;
......
Subproject commit 58be174a410a1595e36105dc3ba6951ae70815ee Subproject commit 1da1c4fbbb8dedf2c8655d9055e417b85548e1cf
This diff is collapsed.
// Generated by CoffeeScript 1.10.0 // Generated by CoffeeScript 1.10.0
(function() { (function() {
var Graveyard, Room, _, bunyan, crypto, debug, dialogues, execFile, fs, http, http_server, https, https_server, log, moment, net, options, os, path, pg, request, requestListener, roomlist, settings, tips, tribute, url, users_cache, wait_room_start, ygopro; var Graveyard, Room, _, bunyan, crypto, debug, dialogues, execFile, fs, http, http_server, https, https_server, lflist, list, log, matched, moment, net, options, os, path, pg, request, requestListener, roomlist, settings, tips, tribute, url, users_cache, wait_room_start, ygopro;
net = require('net'); net = require('net');
...@@ -40,6 +40,21 @@ ...@@ -40,6 +40,21 @@
settings.version = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\d]+)/)[1], '16'); settings.version = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\d]+)/)[1], '16');
lflist = (function() {
var k, len, ref, results;
ref = fs.readFileSync('ygopro/lflist.conf', 'utf8').match(/![\d\.]+(?: TCG)?/g);
results = [];
for (k = 0, len = ref.length; k < len; k++) {
list = ref[k];
matched = list.match(/!([\d\.]+)(?: (TCG))?/);
results.push({
date: moment(matched[1]),
tcg: !!matched[2]
});
}
return results;
})();
ygopro = require('./ygopro.js'); ygopro = require('./ygopro.js');
Room = require('./room.js'); Room = require('./room.js');
...@@ -442,6 +457,9 @@ ...@@ -442,6 +457,9 @@
start_hand: opt3 >> 4, start_hand: opt3 >> 4,
draw_count: opt3 & 0xF draw_count: opt3 & 0xF
}; };
this.hostinfo.lflist = _.findIndex(settings.lflist, function(list) {
return ((rule === 1) === list.tcg) && list.date.isBefore();
});
room = new Room(name, options); room = new Room(name, options);
room.title = info.pass.slice(8).replace(String.fromCharCode(0xFEFF), ' '); room.title = info.pass.slice(8).replace(String.fromCharCode(0xFEFF), ' ');
room["private"] = action === 2; room["private"] = action === 2;
......
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