Commit b35e9dd0 authored by mercury233's avatar mercury233

add switches

parent 21ca68db
{
"windbots": [
{
"name": "琪露诺",
"deck": "Burn",
"dialog": "zh-CN"
},
{
"name": "琪露诺",
"deck": "Frog",
"dialog": "zh-CN"
},
{
"name": "琪露诺",
"deck": "Horus",
"dialog": "zh-CN"
},
{
"name": "琪露诺",
"deck": "OldSchool",
"dialog": "zh-CN"
},
{
"name": "谜之剑士LV4",
"deck": "Dragunity",
"dialog": "zh-CN"
},
{
"name": "谜之剑士LV4",
"deck": "Rank V",
"dialog": "zh-CN"
},
{
"name": "谜之剑士LV4",
"deck": "Zexal Weapons",
"dialog": "zh-CN"
}
]
}
\ No newline at end of file
......@@ -5,58 +5,26 @@
"welcome": "YGOPRO Server",
"update": "请更新游戏版本",
"stop": false,
"tips": "http://mercury233.me/ygosrv233tips.json",
"tips": "http://mercury233.me/ygosrv233/tips.json",
"dialogues": "http://mercury233.me/ygosrv233/dialogues.json",
"enable_websocket_roomlist": false,
"enable_random_duel": false,
"enable_halfway_watch": true,
"enable_TCG_as_default": false,
"enable_cloud_replay": false,
"enable_windbot": false,
"enable_websocket_roomlist": false,
"redis_port": 6379,
"mycard_auth": false,
"hang_timeout": 90,
"http": {
"port": 7922,
"password": "123456",
"ssl": {
"enabled": false
}
},
"windbot": [
{
"name": "琪露诺",
"deck": "Burn",
"dialog": "zh-CN"
},
{
"name": "琪露诺",
"deck": "Frog",
"dialog": "zh-CN"
},
{
"name": "琪露诺",
"deck": "Horus",
"dialog": "zh-CN"
},
{
"name": "琪露诺",
"deck": "OldSchool",
"dialog": "zh-CN"
},
{
"name": "谜之剑士LV4",
"deck": "Dragunity",
"dialog": "zh-CN"
},
{
"name": "谜之剑士LV4",
"deck": "Rank V",
"dialog": "zh-CN"
},
{
"name": "谜之剑士LV4",
"deck": "Zexal Weapons",
"dialog": "zh-CN"
"enabled": false,
"port": 7923,
"cert": "ssl/ygopro-server.crt",
"key": "ssl/ygopro-server.key"
}
]
}
}
}
......@@ -25,7 +25,6 @@ moment = require 'moment'
settings = require './config.json'
settings.BANNED_user = []
settings.BANNED_IP = []
settings.modules.hang_timeout = 90
settings.version = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\d]+)/)[1], '16')
settings.lflist = (for list in fs.readFileSync('ygopro/lflist.conf', 'utf8').match(/!.*/g)
date=list.match(/!([\d\.]+)/)
......@@ -37,6 +36,9 @@ if settings.modules.enable_cloud_replay
zlib = require 'zlib'
redisdb = redis.createClient host: "127.0.0.1", port: settings.modules.redis_port
if settings.modules.enable_windbot
settings.modules.windbots = require('./config.bot.json').windbots
#组件
ygopro = require './ygopro.js'
Room = require './room.js'
......@@ -330,11 +332,11 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
}
client.end()
else if settings.modules.windbot and info.pass[0...2] == 'AI'
else if settings.modules.enable_windbot and info.pass[0...2] == 'AI'
if info.pass.length > 3 and info.pass[0...3] == 'AI#' or info.pass[0...3] == 'AI_'
name = info.pass.slice(3)
windbot = _.sample _.filter settings.modules.windbot, (w)->
windbot = _.sample _.filter settings.modules.windbots, (w)->
w.name == name or w.deck == name
if !windbot
ygopro.stoc_send_chat(client, '主机密码不正确 (Invalid Windbot Name)', 11)
......@@ -345,7 +347,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client.end()
return
else
windbot = _.sample settings.modules.windbot
windbot = _.sample settings.modules.windbots
room = Room.find_or_create_by_name('AI#' + Math.floor(Math.random() * 100000)) # 这个 AI# 没有特殊作用, 仅作为标记
room.windbot = windbot
......
......@@ -36,8 +36,6 @@
settings.BANNED_IP = [];
settings.modules.hang_timeout = 90;
settings.version = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\d]+)/)[1], '16');
settings.lflist = (function() {
......@@ -67,6 +65,10 @@
});
}
if (settings.modules.enable_windbot) {
settings.modules.windbots = require('./config.bot.json').windbots;
}
ygopro = require('./ygopro.js');
Room = require('./room.js');
......@@ -386,10 +388,10 @@
code: 2
});
client.end();
} else if (settings.modules.windbot && info.pass.slice(0, 2) === 'AI') {
} else if (settings.modules.enable_windbot && info.pass.slice(0, 2) === 'AI') {
if (info.pass.length > 3 && info.pass.slice(0, 3) === 'AI#' || info.pass.slice(0, 3) === 'AI_') {
name = info.pass.slice(3);
windbot = _.sample(_.filter(settings.modules.windbot, function(w) {
windbot = _.sample(_.filter(settings.modules.windbots, function(w) {
return w.name === name || w.deck === name;
}));
if (!windbot) {
......@@ -402,7 +404,7 @@
return;
}
} else {
windbot = _.sample(settings.modules.windbot);
windbot = _.sample(settings.modules.windbots);
}
room = Room.find_or_create_by_name('AI#' + Math.floor(Math.random() * 100000));
room.windbot = windbot;
......
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