Commit 5385b1a0 authored by mercury233's avatar mercury233

update log & fix

parent 32c3fe81
...@@ -438,26 +438,26 @@ class Room ...@@ -438,26 +438,26 @@ class Room
score_array=[] score_array=[]
for name, score of @scores for name, score of @scores
score_array.push { name: name, score: score } score_array.push { name: name, score: score }
log.info @start_time, score_array log.info 'SCORE', score_array, @start_time
return if score_array.length != 2 if score_array.length == 2
request.post { url : settings.modules.arena_mode.post_score , form : { request.post { url : settings.modules.arena_mode.post_score , form : {
accesskey: process.env.MYCARD_ARENA_KEY, accesskey: process.env.MYCARD_ARENA_KEY,
usernameA: score_array[0].name, usernameA: score_array[0].name,
usernameB: score_array[1].name, usernameB: score_array[1].name,
userscoreA: score_array[0].score, userscoreA: score_array[0].score,
userscoreB: score_array[1].score, userscoreB: score_array[1].score,
start: @start_time, start: @start_time,
end: moment().format(), end: moment().format(),
arena: if @hostinfo.mode ==1 then 'athletic' else 'entertain' #settings.modules.arena_mode.mode arena: if @hostinfo.mode ==1 then 'athletic' else 'entertain' #settings.modules.arena_mode.mode
}}, (error, response, body)=> }}, (error, response, body)=>
if error if error
log.warn 'SCORE POST ERROR', error, response log.warn 'SCORE POST ERROR', error, response.statusCode, response.statusMessage, body
else
if response.statusCode != 204
log.warn 'SCORE POST', response.statusCode, response.statusMessage, @name, body
else else
log.info 'SCORE POST', response.statusCode, response.statusMessage, @name, body if response.statusCode != 204
return log.warn 'SCORE POST FAIL', response.statusCode, response.statusMessage, @name, body
else
log.info 'SCORE POST OK', response.statusCode, response.statusMessage, @name, body
return
if @player_datas.length and settings.modules.enable_cloud_replay if @player_datas.length and settings.modules.enable_cloud_replay
replay_id = @cloud_replay_id replay_id = @cloud_replay_id
if @has_ygopro_error if @has_ygopro_error
...@@ -1325,7 +1325,7 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)-> ...@@ -1325,7 +1325,7 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
json: true json: true
, (error, response, body)-> , (error, response, body)->
if error or !body or _.isString body if error or !body or _.isString body
log.warn 'LOAD SCORE ERROR', client.name, error, response, body log.warn 'LOAD SCORE ERROR', client.name, error, response.statusCode, response.statusMessage, body
else else
log.info 'LOAD SCORE', client.name, body log.info 'LOAD SCORE', client.name, body
ygopro.stoc_send_chat_to_room(room, "#{client.name} #{body.exp}点经验 #{Math.round(body.pt)}点战斗力 排名第#{body.arena_rank} (正式上线前这些积分可能被重置)", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat_to_room(room, "#{client.name} #{body.exp}点经验 #{Math.round(body.pt)}点战斗力 排名第#{body.arena_rank} (正式上线前这些积分可能被重置)", ygopro.constants.COLORS.BABYBLUE)
...@@ -1349,9 +1349,9 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)-> ...@@ -1349,9 +1349,9 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
log.warn 'DECK POST ERROR', error, response log.warn 'DECK POST ERROR', error, response
else else
if response.statusCode != 200 if response.statusCode != 200
log.warn 'DECK POST', response.statusCode, client.name, body log.warn 'DECK POST FAIL', response.statusCode, client.name, body
else else
log.info 'DECK POST', response.statusCode, client.name, body log.info 'DECK POST OK', response.statusCode, client.name, body
return return
client.deck_saved = true client.deck_saved = true
return return
......
...@@ -592,35 +592,34 @@ ...@@ -592,35 +592,34 @@
score: score score: score
}); });
} }
log.info(this.start_time, score_array); log.info('SCORE', score_array, this.start_time);
if (score_array.length !== 2) { if (score_array.length === 2) {
return; request.post({
} url: settings.modules.arena_mode.post_score,
request.post({ form: {
url: settings.modules.arena_mode.post_score, accesskey: process.env.MYCARD_ARENA_KEY,
form: { usernameA: score_array[0].name,
accesskey: process.env.MYCARD_ARENA_KEY, usernameB: score_array[1].name,
usernameA: score_array[0].name, userscoreA: score_array[0].score,
usernameB: score_array[1].name, userscoreB: score_array[1].score,
userscoreA: score_array[0].score, start: this.start_time,
userscoreB: score_array[1].score, end: moment().format(),
start: this.start_time, arena: this.hostinfo.mode === 1 ? 'athletic' : 'entertain'
end: moment().format(), }
arena: this.hostinfo.mode === 1 ? 'athletic' : 'entertain' }, (function(_this) {
} return function(error, response, body) {
}, (function(_this) { if (error) {
return function(error, response, body) { log.warn('SCORE POST ERROR', error, response.statusCode, response.statusMessage, body);
if (error) {
log.warn('SCORE POST ERROR', error, response);
} else {
if (response.statusCode !== 204) {
log.warn('SCORE POST', response.statusCode, response.statusMessage, _this.name, body);
} else { } else {
log.info('SCORE POST', response.statusCode, response.statusMessage, _this.name, body); if (response.statusCode !== 204) {
log.warn('SCORE POST FAIL', response.statusCode, response.statusMessage, _this.name, body);
} else {
log.info('SCORE POST OK', response.statusCode, response.statusMessage, _this.name, body);
}
} }
} };
}; })(this));
})(this)); }
} }
if (this.player_datas.length && settings.modules.enable_cloud_replay) { if (this.player_datas.length && settings.modules.enable_cloud_replay) {
replay_id = this.cloud_replay_id; replay_id = this.cloud_replay_id;
...@@ -1628,7 +1627,7 @@ ...@@ -1628,7 +1627,7 @@
json: true json: true
}, function(error, response, body) { }, function(error, response, body) {
if (error || !body || _.isString(body)) { if (error || !body || _.isString(body)) {
log.warn('LOAD SCORE ERROR', client.name, error, response, body); log.warn('LOAD SCORE ERROR', client.name, error, response.statusCode, response.statusMessage, body);
} else { } else {
log.info('LOAD SCORE', client.name, body); log.info('LOAD SCORE', client.name, body);
ygopro.stoc_send_chat_to_room(room, client.name + " " + body.exp + "点经验 " + (Math.round(body.pt)) + "点战斗力 排名第" + body.arena_rank + " (正式上线前这些积分可能被重置)", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat_to_room(room, client.name + " " + body.exp + "点经验 " + (Math.round(body.pt)) + "点战斗力 排名第" + body.arena_rank + " (正式上线前这些积分可能被重置)", ygopro.constants.COLORS.BABYBLUE);
...@@ -1660,9 +1659,9 @@ ...@@ -1660,9 +1659,9 @@
log.warn('DECK POST ERROR', error, response); log.warn('DECK POST ERROR', error, response);
} else { } else {
if (response.statusCode !== 200) { if (response.statusCode !== 200) {
log.warn('DECK POST', response.statusCode, client.name, body); log.warn('DECK POST FAIL', response.statusCode, client.name, body);
} else { } else {
log.info('DECK POST', response.statusCode, client.name, body); log.info('DECK POST OK', response.statusCode, client.name, body);
} }
} }
}); });
......
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