Commit ef2d348d authored by nanahira's avatar nanahira

Merge branch 'mc'

parents 976dfada 2562e9e8
...@@ -37,6 +37,7 @@ $RECYCLE.BIN/ ...@@ -37,6 +37,7 @@ $RECYCLE.BIN/
.git* .git*
.dockerignore .dockerignore
.travis.yml
Dockerfile* Dockerfile*
/docs /docs
/README.md /README.md
......
services:
- docker
script:
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
- docker build -t mycard/ygopro-server:latest .
- mkdir output dist
- docker run --rm -v "$PWD/output:/output" mycard/ygopro-server:latest -e 'require("child_process").execSync("cp -rf ./* /output")'
- cd output && tar -zcf ../dist/ygopro-server.tar.gz --format=posix --exclude='.git*' ./* && cd ..
- docker push mycard/ygopro-server:latest
deploy:
provider: s3
access_key_id: ztDf0fCxr0eCgSIi
secret_access_key:
secure: Bm63Gi9Ok19pxhPiCbNnXlRYCmxxZWsj/PfxqGm1ruWLxinjJfpQHSRzSNTb/j0D8kK3uzUB+9MjrtcA5Nnfby4r+zuU+gvpW+3hOX2TiEtCSqYjenQmSsLD5WelMrBHXwfAQ5jOBzkdtC0vX4UTLAGcwJ8DhL9CbMJi0ZqDK9o=
bucket: mycard
skip_cleanup: true
local-dir: dist
upload-dir: srvpro
endpoint: https://minio.mycard.moe:9000
This diff is collapsed.
...@@ -1120,6 +1120,7 @@ class Room ...@@ -1120,6 +1120,7 @@ class Room
@turn = 0 @turn = 0
@duel_stage = ygopro.constants.DUEL_STAGE.BEGIN @duel_stage = ygopro.constants.DUEL_STAGE.BEGIN
@replays = [] @replays = []
@first_list = []
ROOM_all.push this ROOM_all.push this
@hostinfo ||= JSON.parse(JSON.stringify(settings.hostinfo)) @hostinfo ||= JSON.parse(JSON.stringify(settings.hostinfo))
...@@ -1328,6 +1329,7 @@ class Room ...@@ -1328,6 +1329,7 @@ class Room
userscoreB: score_array[1].score, userscoreB: score_array[1].score,
userdeckA: score_array[0].deck, userdeckA: score_array[0].deck,
userdeckB: score_array[1].deck, userdeckB: score_array[1].deck,
first: @first_list,
replays: formatted_replays, replays: formatted_replays,
start: @start_time, start: @start_time,
end: end_time, end: end_time,
...@@ -2157,7 +2159,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)-> ...@@ -2157,7 +2159,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)->
skip_track_visit: true skip_track_visit: true
json: true json: true
, (error, response, body)-> , (error, response, body)->
if body and body.user if !error and body and body.user
users_cache[client.name] = body.user.id users_cache[client.name] = body.user.id
secret = body.user.id % 65535 + 1 secret = body.user.id % 65535 + 1
decrypted_buffer = Buffer.allocUnsafe(6) decrypted_buffer = Buffer.allocUnsafe(6)
...@@ -2165,6 +2167,10 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)-> ...@@ -2165,6 +2167,10 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server, datas)->
decrypted_buffer.writeUInt16LE(buffer.readUInt16LE(i) ^ secret, i) decrypted_buffer.writeUInt16LE(buffer.readUInt16LE(i) ^ secret, i)
if check_buffer_indentity(decrypted_buffer) if check_buffer_indentity(decrypted_buffer)
buffer = decrypted_buffer buffer = decrypted_buffer
else
log.warn("READ USER FAIL", error, body)
ygopro.stoc_die(client, "${create_room_failed}")
return
# buffer != decrypted_buffer ==> auth failed # buffer != decrypted_buffer ==> auth failed
...@@ -2553,6 +2559,8 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server, datas)-> ...@@ -2553,6 +2559,8 @@ ygopro.stoc_follow 'GAME_MSG', true, (buffer, info, client, server, datas)->
if ygopro.constants.MSG[msg] == 'START' if ygopro.constants.MSG[msg] == 'START'
playertype = buffer.readUInt8(1) playertype = buffer.readUInt8(1)
client.is_first = !(playertype & 0xf) client.is_first = !(playertype & 0xf)
if client.is_first and (room.hostinfo.mode != 2 or client.pos == 0 or client.pos == 2)
room.first_list[room.duel_count - 1] = client.name_vpass
client.lp = room.hostinfo.start_lp client.lp = room.hostinfo.start_lp
client.card_count = 0 if room.hostinfo.mode != 2 client.card_count = 0 if room.hostinfo.mode != 2
room.duel_stage = ygopro.constants.DUEL_STAGE.DUELING room.duel_stage = ygopro.constants.DUEL_STAGE.DUELING
......
...@@ -1454,6 +1454,7 @@ ...@@ -1454,6 +1454,7 @@
this.turn = 0; this.turn = 0;
this.duel_stage = ygopro.constants.DUEL_STAGE.BEGIN; this.duel_stage = ygopro.constants.DUEL_STAGE.BEGIN;
this.replays = []; this.replays = [];
this.first_list = [];
ROOM_all.push(this); ROOM_all.push(this);
this.hostinfo || (this.hostinfo = JSON.parse(JSON.stringify(settings.hostinfo))); this.hostinfo || (this.hostinfo = JSON.parse(JSON.stringify(settings.hostinfo)));
delete this.hostinfo.comment; delete this.hostinfo.comment;
...@@ -1737,6 +1738,7 @@ ...@@ -1737,6 +1738,7 @@
userscoreB: score_array[1].score, userscoreB: score_array[1].score,
userdeckA: score_array[0].deck, userdeckA: score_array[0].deck,
userdeckB: score_array[1].deck, userdeckB: score_array[1].deck,
first: this.first_list,
replays: formatted_replays, replays: formatted_replays,
start: this.start_time, start: this.start_time,
end: end_time, end: end_time,
...@@ -2747,7 +2749,7 @@ ...@@ -2747,7 +2749,7 @@
json: true json: true
}, function(error, response, body) { }, function(error, response, body) {
var len3, n, ref4; var len3, n, ref4;
if (body && body.user) { if (!error && body && body.user) {
users_cache[client.name] = body.user.id; users_cache[client.name] = body.user.id;
secret = body.user.id % 65535 + 1; secret = body.user.id % 65535 + 1;
decrypted_buffer = Buffer.allocUnsafe(6); decrypted_buffer = Buffer.allocUnsafe(6);
...@@ -2759,6 +2761,10 @@ ...@@ -2759,6 +2761,10 @@
if (check_buffer_indentity(decrypted_buffer)) { if (check_buffer_indentity(decrypted_buffer)) {
buffer = decrypted_buffer; buffer = decrypted_buffer;
} }
} else {
log.warn("READ USER FAIL", error, body);
ygopro.stoc_die(client, "${create_room_failed}");
return;
} }
if (!check_buffer_indentity(buffer)) { if (!check_buffer_indentity(buffer)) {
ygopro.stoc_die(client, '${invalid_password_checksum}'); ygopro.stoc_die(client, '${invalid_password_checksum}');
...@@ -3211,6 +3217,9 @@ ...@@ -3211,6 +3217,9 @@
if (ygopro.constants.MSG[msg] === 'START') { if (ygopro.constants.MSG[msg] === 'START') {
playertype = buffer.readUInt8(1); playertype = buffer.readUInt8(1);
client.is_first = !(playertype & 0xf); client.is_first = !(playertype & 0xf);
if (client.is_first && (room.hostinfo.mode !== 2 || client.pos === 0 || client.pos === 2)) {
room.first_list[room.duel_count - 1] = client.name_vpass;
}
client.lp = room.hostinfo.start_lp; client.lp = room.hostinfo.start_lp;
if (room.hostinfo.mode !== 2) { if (room.hostinfo.mode !== 2) {
client.card_count = 0; client.card_count = 0;
......
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