Commit bfd5f993 authored by 神楽坂玲奈's avatar 神楽坂玲奈

windbot

parent 8767710c
......@@ -20,7 +20,9 @@ RUN strip ygopro
RUN mv /usr/src/app/windbot /usr/src/app/windbot-source
WORKDIR /usr/src/app/windbot-source
RUN xbuild /property:Configuration=Release /property:OutDir=/usr/src/app/windbot/
WORKDIR /usr/src/app
RUN rm -rf /usr/src/app/windbot-source
RUN ln -s /usr/src/app/ygopro/cards.cdb /usr/src/app/windbot/cards.cdb
WORKDIR /usr/src/app
CMD [ "npm", "start" ]
{
"port": 7911,
"ygopro_path": "ygopro",
"modules": {
"welcome": "YGOPRO Server",
"update": "请更新游戏版本",
"stop": false,
"tips": "http://mycard.moe/ygopro/tips.json",
"dialogues": "http://mycard.moe/ygopro/dialogues.json",
"redis_port": 6379,
"enable_websocket_roomlist": true,
"enable_random_duel": false,
"mycard_auth": "https://ygobbs.com",
"post_start_watching": true,
"TCG_banlist_id": 8,
"enable_TCG_as_default": false,
"http": {
"port": 7922,
"password": "123456",
"ssl": {
"enabled": true,
"port": 7923,
"cert": "ssl/ygopro-server.crt",
"key": "ssl/ygopro-server.key"
}
}
}
"port": 7911,
"ygopro_path": "ygopro",
"modules": {
"welcome": "YGOPRO Server",
"update": "请更新游戏版本",
"stop": false,
"tips": "http://mycard.moe/ygopro/tips.json",
"dialogues": "http://mycard.moe/ygopro/dialogues.json",
"redis_port": 6379,
"enable_websocket_roomlist": true,
"enable_random_duel": false,
"mycard_auth": "https://ygobbs.com",
"post_start_watching": true,
"TCG_banlist_id": 8,
"enable_TCG_as_default": false,
"http": {
"port": 7922,
"password": "123456",
"ssl": {
"enabled": true,
"port": 7923,
"cert": "ssl/ygopro-server.crt",
"key": "ssl/ygopro-server.key"
}
},
"windbot": [
{
"name": "啪啪尼",
"deck": "Dragunity"
}
]
}
}
......@@ -318,6 +318,15 @@ class Room
player.pre_establish_buffers = []
return
return
console.log @windbot
if @windbot
spawn 'mono', ['WindBot.exe'], {cwd: 'windbot', env: {
YGOPRO_VERSION: settings.version
YGOPRO_HOST: '127.0.0.1'
YGOPRO_PORT: @port
YGOPRO_NAME: @windbot.name
YGOPRO_DECK: @windbot.deck
}}
return
catch
@error = "建立房间失败,请重试"
......
......@@ -412,6 +412,19 @@
player.pre_establish_buffers = [];
});
});
console.log(_this.windbot);
if (_this.windbot) {
spawn('mono', ['WindBot.exe'], {
cwd: 'windbot',
env: {
YGOPRO_VERSION: settings.version,
YGOPRO_HOST: '127.0.0.1',
YGOPRO_PORT: _this.port,
YGOPRO_NAME: _this.windbot.name,
YGOPRO_DECK: _this.windbot.deck
}
});
}
};
})(this));
} catch (error1) {
......
Subproject commit 2241def41d8259ce023e94cede8593c51925cc93
Subproject commit 5a7b65570c43bf8bfbc0434625be154ff3fabe4b
......@@ -320,7 +320,16 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
}
client.end()
else if settings.modules.windbot and info.pass[0...2] == 'AI'
room = Room.find_or_create_by_name('M#AI' + Math.random().toString())
room.windbot = _.sample settings.modules.windbot
room.private = true
client.room = room
client.room.connect(client)
else if info.pass.length and settings.modules.mycard_auth
console.log settings.modules.windbot
ygopro.stoc_send_chat(client,'正在读取用户信息...', 11)
if info.pass.length <= 8
ygopro.stoc_send_chat(client,'主机密码不正确 (Invalid Length)', 11)
......@@ -737,6 +746,8 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
for player in client.room.players when player.pos != 7
client.room.dueling_players[player.pos] = player
client.room.player_datas.push ip:player.remoteAddress, name:player.name
if client.room.windbot
client.room.dueling_players[1 - player.pos] = {}
if settings.modules.tips
ygopro.stoc_send_random_tip(client)
return
......
......@@ -350,7 +350,14 @@
code: 2
});
client.end();
} else if (settings.modules.windbot && info.pass.slice(0, 2) === 'AI') {
room = Room.find_or_create_by_name('M#AI' + Math.random().toString());
room.windbot = _.sample(settings.modules.windbot);
room["private"] = true;
client.room = room;
client.room.connect(client);
} else if (info.pass.length && settings.modules.mycard_auth) {
console.log(settings.modules.windbot);
ygopro.stoc_send_chat(client, '正在读取用户信息...', 11);
if (info.pass.length <= 8) {
ygopro.stoc_send_chat(client, '主机密码不正确 (Invalid Length)', 11);
......@@ -380,7 +387,7 @@
return (checksum & 0xFF) === 0;
};
finish = function(buffer) {
var action, name, opt1, opt2, opt3, options, room;
var action, name, opt1, opt2, opt3, options;
action = buffer.readUInt8(1) >> 4;
if (buffer !== decrypted_buffer && (action === 1 || action === 2 || action === 4)) {
ygopro.stoc_send_chat(client, '主机密码不正确 (Unauthorized)', 11);
......@@ -853,6 +860,9 @@
ip: player.remoteAddress,
name: player.name
});
if (client.room.windbot) {
client.room.dueling_players[1 - player.pos] = {};
}
}
}
if (settings.modules.tips) {
......
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