Commit a51672cb authored by mercury233's avatar mercury233

update config

parent 882a6b04
# 23333333
config.json
/config.json
# ignore
test*
/ygocore/
/ygocore
/ygopro/
/ygopro
node_modules/.bin/
node_modules/bunyan/
......
{
"ip": "123.45.67.89",
"port": 233,
"version": 4918,
"ygopro_path": "ygocore",
"modules": {
"welcome": "YGOPRO Server",
"update": "请更新游戏版本",
"stop": false,
"tips": "http://mercury233.me/ygosrv233/tips.json",
"dialogues": "http://mercury233.me/ygosrv233/dialogues.json",
"enable_random_duel": false,
"post_start_watching": true,
"TCG_banlist_id": 7,
"TCG_banlist_id": 8,
"enable_TCG_as_default": false,
"http": {
"port": 7922,
"password": "123456"
},
"pre": {
"port": 7911,
"password": "123456",
"git_html_path": "../mercury233.github.io/",
"html_path": "../mercury233.github.io/ygosrv233/",
"html_filename": "pre.html",
"git_db_path": "../ygopro-cards/",
"db_path": "../ygopro-cards/unofficial/",
"html_img_rel_path": "pre/pics/",
"ygopro_path": "../ygopro-pre/"
}
}
}
\ No newline at end of file
{
"port": 2333,
"password": "123456",
"git_html_path": "../mercury233.github.io/",
"html_path": "../mercury233.github.io/ygosrv233/",
"html_filename": "pre.html",
"git_db_path": "../ygopro-cards/",
"db_path": "../ygopro-cards/unofficial/",
"html_img_rel_path": "pre/pics/",
"ygopro_path": "../ygopro-pre/"
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ class Room
@players_oppentlist = {}
@find_or_create_by_name: (name, player_name)->
if name == '' or name.toUpperCase() == 'S' or name.toUpperCase() == 'M'
if settings.modules.enable_random_duel and (name == '' or name.toUpperCase() == 'S' or name.toUpperCase() == 'M')
return @find_or_create_random(name.toUpperCase(), player_name)
if room = @find_by_name(name)
return room
......@@ -243,7 +243,7 @@ class Room
param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, (if @hostinfo.enable_priority then 'T' else 'F'), (if @hostinfo.no_check_deck then 'T' else 'F'), (if @hostinfo.no_shuffle_deck then 'T' else 'F'), @hostinfo.start_lp, @hostinfo.start_hand, @hostinfo.draw_count, @hostinfo.time_limit]
try
@process = spawn './ygopro', param, cwd: 'ygocore'
@process = spawn './ygopro', param, cwd: settings.ygopro_path
@process.on 'exit', (code)=>
@disconnector = 'server' unless @disconnector
this.delete()
......
......@@ -47,7 +47,7 @@
Room.find_or_create_by_name = function(name, player_name) {
var room;
if (name === '' || name.toUpperCase() === 'S' || name.toUpperCase() === 'M') {
if (settings.modules.enable_random_duel && (name === '' || name.toUpperCase() === 'S' || name.toUpperCase() === 'M')) {
return this.find_or_create_random(name.toUpperCase(), player_name);
}
if (room = this.find_by_name(name)) {
......@@ -293,7 +293,7 @@
param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, (this.hostinfo.enable_priority ? 'T' : 'F'), (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit];
try {
this.process = spawn('./ygopro', param, {
cwd: 'ygocore'
cwd: settings.ygopro_path
});
this.process.on('exit', (function(_this) {
return function(code) {
......
......@@ -15,7 +15,7 @@ var spawn = require('child_process').spawn;
var url = require('url');
var constants = require('./constants.json');
var config = require('./config.json').modules.pre;
var config = require('./config.pre.json');
//全卡HTML列表
var cardHTMLs=[];
......
......@@ -216,7 +216,7 @@ net.createServer (client) ->
return
return
.listen settings.port, ->
log.info "server started", settings.ip, settings.port
log.info "server started", settings.port
return
#功能模块
......@@ -241,20 +241,20 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client.end()
else if info.version != settings.version
ygopro.stoc_send_chat(client,"电脑用户请更新游戏到最新版本,手机用户可以尝试使用2333端口,有问题请加群275986039")
ygopro.stoc_send_chat(client,settings.modules.update)
ygopro.stoc_send client, 'ERROR_MSG',{
msg: 4
code: settings.version
}
client.end()
#else if !info.pass.length
# ygopro.stoc_send_chat(client,"房间为空,请修改房间名")
# ygopro.stoc_send client, 'ERROR_MSG',{
# msg: 1
# code: 2
# }
# client.end()
else if !info.pass.length and !settings.modules.enable_random_duel
ygopro.stoc_send_chat(client,"房间为空,请修改房间名")
ygopro.stoc_send client, 'ERROR_MSG',{
msg: 1
code: 2
}
client.end()
else if !Room.validate(info.pass)
#ygopro.stoc_send client, 'ERROR_MSG',{
......
......@@ -241,7 +241,7 @@
}
});
}).listen(settings.port, function() {
log.info("server started", settings.ip, settings.port);
log.info("server started", settings.port);
});
ygopro.ctos_follow('PLAYER_INFO', true, function(buffer, info, client, server) {
......@@ -265,12 +265,19 @@
});
client.end();
} else if (info.version !== settings.version) {
ygopro.stoc_send_chat(client, "电脑用户请更新游戏到最新版本,手机用户可以尝试使用2333端口,有问题请加群275986039");
ygopro.stoc_send_chat(client, settings.modules.update);
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 4,
code: settings.version
});
client.end();
} else if (!info.pass.length && !settings.modules.enable_random_duel) {
ygopro.stoc_send_chat(client, "房间为空,请修改房间名");
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 1,
code: 2
});
client.end();
} else if (!Room.validate(info.pass)) {
ygopro.stoc_send_chat(client, "房间密码不正确");
ygopro.stoc_send(client, 'ERROR_MSG', {
......
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