Commit 1c8310b7 authored by nanahira's avatar nanahira

update config

parent b42b8997
......@@ -68,7 +68,7 @@
},
"vip": {
"enabled": false,
"generate_count": 50
"generate_count": 1000
},
"random_duel": {
"enabled": false,
......
......@@ -58,6 +58,7 @@
"180": [],
"90": [],
"30": [],
"15": [],
"7": [],
"3": [],
"1": []
......
......@@ -155,10 +155,11 @@ setting_change = (settings, path, val) ->
VIP_generate_cdkeys = (key_type, count) ->
return false unless settings.modules.vip.enabled and vip_info.cdkeys[key_type]
for i in [1...count]
for i in [0...count]
key = Math.floor(Math.random() * 10000000000000000).toString()
vip_info.cdkeys[key_type].push(key)
setting_save(vip_info)
log.info("keys generated", key_type, count, vip_info.cdkeys[key_type].length)
return true
CLIENT_use_cdkey = (client, pkey) ->
......@@ -280,8 +281,6 @@ try
vip_info = loadJSON('./config/vip_info.json')
catch
vip_info = default_data.vip_info
for k,v of vip_info.cdkeys
VIP_generate_cdkeys(k, settings.modules.vip.generate_count)
setting_save(vip_info)
try
......@@ -358,6 +357,10 @@ if settings.modules.challonge.enabled
apiKey: settings.modules.challonge.api_key
})
if settings.modules.vip.enabled
for k,v of vip_info.cdkeys when v.length == 0
VIP_generate_cdkeys(k, settings.modules.vip.generate_count)
# 获取可用内存
memory_usage = 0
get_memory_usage = ()->
......
......@@ -165,11 +165,12 @@
if (!(settings.modules.vip.enabled && vip_info.cdkeys[key_type])) {
return false;
}
for (i = j = 1, ref = count; 1 <= ref ? j < ref : j > ref; i = 1 <= ref ? ++j : --j) {
for (i = j = 0, ref = count; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) {
key = Math.floor(Math.random() * 10000000000000000).toString();
vip_info.cdkeys[key_type].push(key);
}
setting_save(vip_info);
log.info("keys generated", key_type, count, vip_info.cdkeys[key_type].length);
return true;
};
......@@ -343,11 +344,6 @@
vip_info = loadJSON('./config/vip_info.json');
} catch (error1) {
vip_info = default_data.vip_info;
ref = vip_info.cdkeys;
for (k in ref) {
v = ref[k];
VIP_generate_cdkeys(k, settings.modules.vip.generate_count);
}
setting_save(vip_info);
}
......@@ -362,9 +358,9 @@
lflists = [];
try {
ref1 = fs.readFileSync('ygopro/expansions/lflist.conf', 'utf8').match(/!.*/g);
for (j = 0, len = ref1.length; j < len; j++) {
list = ref1[j];
ref = fs.readFileSync('ygopro/expansions/lflist.conf', 'utf8').match(/!.*/g);
for (j = 0, len = ref.length; j < len; j++) {
list = ref[j];
date = list.match(/!([\d\.]+)/);
if (!date) {
continue;
......@@ -379,9 +375,9 @@
}
try {
ref2 = fs.readFileSync('ygopro/lflist.conf', 'utf8').match(/!.*/g);
for (l = 0, len1 = ref2.length; l < len1; l++) {
list = ref2[l];
ref1 = fs.readFileSync('ygopro/lflist.conf', 'utf8').match(/!.*/g);
for (l = 0, len1 = ref1.length; l < len1; l++) {
list = ref1[l];
date = list.match(/!([\d\.]+)/);
if (!date) {
continue;
......@@ -454,6 +450,16 @@
});
}
if (settings.modules.vip.enabled) {
ref2 = vip_info.cdkeys;
for (k in ref2) {
v = ref2[k];
if (v.length === 0) {
VIP_generate_cdkeys(k, settings.modules.vip.generate_count);
}
}
}
memory_usage = 0;
get_memory_usage = function() {
......
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