Commit b01abf01 authored by nanahira's avatar nanahira
parents 689e9e67 5de69b3c
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
}, },
"dialogues": { "dialogues": {
"enabled": true, "enabled": true,
"get_custom": "http://purerosefallen.github.io/ygopro-tips/dialogues-222.json",
"get": "http://mercury233.me/ygosrv233/dialogues.json" "get": "http://mercury233.me/ygosrv233/dialogues.json"
}, },
"words": { "words": {
......
{
"file": "./config/config.json",
"port": 1262,
"version": 4930,
"hostinfo": {
"lflist": 0,
"rule": 0,
"mode": 0,
"comment": "rule: 0=OCGONLY, 1=TCGONLY, 2=OT; mode: 0=SINGLE, 1=MATCH, 2=TAG",
"enable_priority": false,
"no_check_deck": false,
"no_shuffle_deck": false,
"start_lp": 8000,
"start_hand": 5,
"draw_count": 1,
"time_limit": 180
},
"modules": {
"welcome": "YGOPro Tourney",
"update": "请更新游戏版本",
"stop": false,
"side_timeout": 3,
"i18n": {
"auto_pick": false,
"default": "zh-cn",
"fallback": "en-us",
"map": {
"CN": "zh-cn",
"HK": "zh-cn",
"MO": "zh-cn",
"TW": "zh-cn",
"KR": "ko-kr"
}
},
"tips": {
"enabled": true,
"get": "https://purerosefallen.github.io/ygopro-tips/tips.json"
},
"dialogues": {
"enabled": true,
"get_custom": "http://purerosefallen.github.io/ygopro-tips/dialogues-222.json",
"get": "http://mercury233.me/ygosrv233/dialogues.json"
},
"words": {
"enabled": false,
"get": false
},
"music": {
"enabled": false,
"dbpath": "expansions/222DIY.cdb"
},
"random_duel": {
"enabled": false,
"no_rematch_check": false,
"hang_timeout": 90
},
"cloud_replay": {
"enabled": true,
"redis_port": 6379,
"enable_halfway_watch": true
},
"windbot": {
"enabled": false,
"botlist": "./windbot/bots.json",
"spawn": false,
"port": 2399,
"server_ip": "127.0.0.1",
"my_ip": "127.0.0.1"
},
"chat_color": {
"enabled": false
},
"mycard": {
"enabled": false,
"auth_base_url": "https://ygobbs.com",
"auth_database": "postgres://233@233.mycard.moe/233",
"auth_key": "233333"
},
"deck_log": {
"enabled": false,
"accesskey": "233",
"local": "./decks_save/",
"post": false,
"arena": "233"
},
"big_brother": {
"enabled": false,
"accesskey": "233",
"post": "https://api.mycard.moe/ygopro/big-brother"
},
"arena_mode": {
"enabled": false,
"mode": "entertain",
"comment": "mode: athletic / entertain",
"accesskey": "233",
"post_score": false,
"get_score": false
},
"tournament_mode": {
"enabled": true,
"deck_check": true,
"deck_path": "./decks/",
"replay_safe": true,
"replay_path": "./replays/",
"replay_archive_tool": "7z",
"block_replay_to_player": true,
"show_ip": true,
"show_info": true,
"log_save_path": "./config/",
"password": "Nanahira",
"port": 1264
},
"test_mode": {
"watch_public_hand": false,
"no_connect_count_limit": false,
"no_ban_player": false
},
"pre_util": {
"enabled": false,
"port": 7944,
"password": "123456",
"git_html_path": "../mercury233.github.io/",
"html_path": "../mercury233.github.io/ygosrv233/",
"html_filename": "pre.html",
"git_db_path": "../ygopro-pre-data/",
"db_path": "../ygopro-pre-data/unofficial/",
"html_img_rel_path": "pre/pics/",
"html_img_thumbnail": "thumbnail/",
"html_img_thumbnail_suffix": "!thumb",
"cdn": {
"enabled": false,
"exe": "upx",
"params": [
"sync"
],
"local": "./ygosrv233",
"remote": "/ygosrv233",
"pics_remote": "/ygopro/"
},
"ygopro_path": "../ygopro-pre/",
"only_show_dbs": {
"news.cdb": true,
"pre-release.cdb": true
},
"html_gits": [
{
"name": "GitHub",
"push": [
"push",
"origin"
]
},
{
"name": "Coding",
"push": [
"push",
"coding",
"master:master"
]
}
]
},
"webhook": {
"enabled": true,
"port": 7213,
"password": "Nanahira",
"hooks": {
"script": {
"path": "./ygopro/script/",
"remote": "origin",
"branch": "master",
"callback": {
"command": "git",
"args": [
"reset",
"--hard",
"FETCH_HEAD"
],
"path": "./ygopro/script/"
}
},
"windbot": {
"path": "./windbot/",
"remote": "origin",
"branch": "master",
"callback": {
"command": "xbuild",
"args": [
"/property:Configuration=Release"
],
"path": "./windbot/"
}
},
"ygopro": {
"path": "./ygopro/",
"remote": "origin",
"branch": "master",
"callback": {
"command": "bash",
"args": [
"-c",
"premake4 gmake ; cd build ; make config=release ; cd .. ; strip ygopro"
],
"path": "./ygopro/"
}
},
"srvpro": {
"path": ".",
"remote": "origin",
"branch": "master",
"callback": {
"command": "npm",
"args": [
"install"
],
"path": "."
}
}
}
},
"update_util": {
"enabled": false,
"port": 7955,
"password": "123456",
"git_html_path": "../ygo233-web/",
"html_path": "../ygo233-web/",
"cdb_path": "./ygopro/cards.cdb",
"script_path": "./ygopro/script",
"changelog_filename": "changelog.json",
"html_gits": [
{
"name": "GitHub",
"push": [
"push",
"origin"
]
},
{
"name": "Coding",
"push": [
"push",
"coding",
"master:master"
]
}
]
},
"command": {
"enabled": true,
"identity": {
"username1": "password1",
"username1": "password2"
},
"command_list": {
"ygopro": {
"command": "git",
"args": [
"pull",
"origin",
"master"
],
"path": "./ygopro/"
},
"make": {
"command": "make",
"args": [
"config=release"
],
"path": "./ygopro/build/"
},
"srvpro": {
"command": "git",
"args": [
"pull",
"origin",
"master"
],
"path": "."
},
"windbot": {
"command": "git",
"args": [
"pull",
"origin",
"master"
],
"path": "./windbot/"
},
"buildbot": {
"command": "xbuild",
"args": [
"/property:Configuration=Release"
],
"path": "./windbot/"
},
"restartbot": {
"command": "pm2",
"args": [
"restart",
"windbot-server"
],
"path": "."
},
"restart": {
"command": "pm2",
"args": [
"restart",
"ygopro-server"
],
"path": "."
},
"script": {
"command": "git",
"args": [
"pull",
"origin",
"master"
],
"path": "./ygopro/script/"
}
}
},
"http": {
"port": 1263,
"password": "Nanahira",
"websocket_roomlist": true,
"public_roomlist": true,
"show_ip": true,
"show_info": true,
"quick_death_rule": true,
"ssl": {
"enabled": false,
"port": 7923,
"cert": "ssl/fullchain.pem",
"key": "ssl/privkey.pem"
}
}
},
"ban": {
"banned_user": [],
"banned_ip": [],
"illegal_id": [
"^Lv\\.-*\\d+\\s*(.*)",
"^VIP\\.\\d+\\s*(.*)"
],
"spam_word": [
"——"
]
}
}
{
"dbfile": "ygopro/cards.cdb",
"deckpath": "decks_save"
}
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
}, },
"dialogues": { "dialogues": {
"enabled": true, "enabled": true,
"get_custom": "http://purerosefallen.github.io/ygopro-tips/dialogues-222.json",
"get": "http://mercury233.me/ygosrv233/dialogues.json" "get": "http://mercury233.me/ygosrv233/dialogues.json"
}, },
"words": { "words": {
......
...@@ -33,6 +33,14 @@ ...@@ -33,6 +33,14 @@
"58481572": [ "58481572": [
"我们来做朋友吧!" "我们来做朋友吧!"
] ]
},
"dialogues_custom": {
"37564303": [
"泡沫君のようだ\n触れて壊さぬように\n刹那哀のまほろば\n見守るよ"
],
"37564765": [
"キラキラひかる空\n二つ並ぶ白い雲\nスカートなびかせて\n裾を掴む影ぼうし"
]
} }
}, },
"duel_log": { "duel_log": {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
(function() { (function() {
var Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_players_banned, ROOM_players_oppentlist, ROOM_unwelcome, ROOM_validate, Room, _, addCallback, badwords, ban_user, bunyan, chat_color, config, cppversion, crypto, date, default_config, default_data, dialogues, duel_log, e, exec, execFile, fs, geoip, get_memory_usage, http, http_server, https, https_server, lflists, list, loadJSON, load_dialogues, load_tips, log, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, tips, url, users_cache, wait_room_start, wait_room_start_arena, windbot_bin, windbot_parameters, windbot_process, windbots, ygopro, zlib; var Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_players_banned, ROOM_players_oppentlist, ROOM_unwelcome, ROOM_validate, Room, _, addCallback, badwords, ban_user, bunyan, chat_color, config, cppversion, crypto, date, default_config, default_data, dialogues, duel_log, e, exec, execFile, fs, geoip, get_memory_usage, http, http_server, https, https_server, lflists, list, loadJSON, load_dialogues, load_tips, log, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, tips, url, users_cache, wait_room_start, wait_room_start_arena, windbot_bin, windbot_parameters, windbot_process, windbots, ygopro, zlib;
var words, oldwords; var words, oldwords, load_dialogues_custom;
net = require('net'); net = require('net');
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
olddialogues = {}; olddialogues = {};
olddialogues.file = './config/dialogues.json'; olddialogues.file = './config/dialogues.json';
olddialogues.dialogues = oldconfig.dialogues; olddialogues.dialogues = oldconfig.dialogues;
olddialogues.dialogues_custom = {};
fs.writeFileSync(olddialogues.file, JSON.stringify(olddialogues, null, 2)); fs.writeFileSync(olddialogues.file, JSON.stringify(olddialogues, null, 2));
delete oldconfig.dialogues; delete oldconfig.dialogues;
} }
...@@ -187,6 +188,10 @@ ...@@ -187,6 +188,10 @@
try { try {
dialogues = loadJSON('./config/dialogues.json'); dialogues = loadJSON('./config/dialogues.json');
if (!dialogues.dialogues_custom) {
dialogues.dialogues_custom = {};
setting_save(dialogues);
}
} catch (error1) { } catch (error1) {
dialogues = default_data.dialogues; dialogues = default_data.dialogues;
setting_save(dialogues); setting_save(dialogues);
...@@ -1665,10 +1670,30 @@ ...@@ -1665,10 +1670,30 @@
}); });
}; };
load_dialogues_custom = function() {
request({
url: settings.modules.dialogues.get_custom,
json: true
}, function(error, response, body) {
if (_.isString(body)) {
log.warn("custom dialogues bad json", body);
} else if (error || !body) {
log.warn('custom dialogues error', error, response);
} else {
setting_change(dialogues, "dialogues_custom", body);
log.info("custom dialogues loaded", _.size(dialogues.dialogues_custom));
}
});
};
if (settings.modules.dialogues.get) { if (settings.modules.dialogues.get) {
load_dialogues(); load_dialogues();
} }
if (settings.modules.dialogues.get_custom) {
load_dialogues_custom();
}
ygopro.stoc_follow('GAME_MSG', false, function(buffer, info, client, server) { ygopro.stoc_follow('GAME_MSG', false, function(buffer, info, client, server) {
var card, j, len, line, msg, oppo_pos, playertype, pos, reason, ref, ref1, ref2, room, val; var card, j, len, line, msg, oppo_pos, playertype, pos, reason, ref, ref1, ref2, room, val;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
...@@ -1817,6 +1842,12 @@ ...@@ -1817,6 +1842,12 @@
line = ref2[j]; line = ref2[j];
ygopro.stoc_send_chat(client, line, ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat(client, line, ygopro.constants.COLORS.PINK);
} }
} else if (dialogues.dialogues_custom[card]) {
ref2 = _.lines(dialogues.dialogues_custom[card][Math.floor(Math.random() * dialogues.dialogues_custom[card].length)]);
for (j = 0, len = ref2.length; j < len; j++) {
line = ref2[j];
ygopro.stoc_send_chat(client, line, ygopro.constants.COLORS.PINK);
}
} }
} }
} }
...@@ -3015,8 +3046,11 @@ ...@@ -3015,8 +3046,11 @@
response.end(addCallback(u.query.callback, "['loading tip', '" + settings.modules.tips.get + "']")); response.end(addCallback(u.query.callback, "['loading tip', '" + settings.modules.tips.get + "']"));
} else if (u.query.loaddialogues) { } else if (u.query.loaddialogues) {
load_dialogues(); load_dialogues();
if (settings.modules.dialogues.get_custom) {
load_dialogues_custom();
}
response.writeHead(200); response.writeHead(200);
response.end(addCallback(u.query.callback, "['loading dialogues', '" + settings.modules.dialogues.get + "']")); response.end(addCallback(u.query.callback, "['loading dialogues', '" + settings.modules.dialogues.get + (settings.modules.dialogues.get_custom ? (" and " + settings.modules.dialogues.get_custom) : "") + "']"));
} else if (u.query.loadwords) { } else if (u.query.loadwords) {
load_words(); load_words();
response.writeHead(200); response.writeHead(200);
......
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