Commit fdfa6015 authored by mercury233's avatar mercury233

show score to player himself

parent 37994644
......@@ -1081,6 +1081,19 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
ygopro.stoc_send_chat(client, settings.modules.welcome, ygopro.constants.COLORS.GREEN)
if room.welcome
ygopro.stoc_send_chat(client, room.welcome, ygopro.constants.COLORS.BABYBLUE)
if settings.modules.arena_mode.get_score #and not client.score_shown
request
url: settings.modules.arena_mode.get_score + encodeURIComponent(client.name),
json: true
, (error, response, body)->
if error or !body or _.isString body
log.warn 'LOAD SCORE ERROR', client.name, error, response.statusCode, response.statusMessage, body
else
log.info 'LOAD SCORE', client.name, body
rank_txt = if body.arena_rank>0 then "排名第" + body.arena_rank else "暂无排名"
ygopro.stoc_send_chat(client, "#{client.name},你有#{body.exp}点经验,你的战斗力是#{Math.round(body.pt)}#{rank_txt}。正式上线前这些积分可能被重置。", ygopro.constants.COLORS.BABYBLUE)
#client.score_shown = true
return
if !room.recorder
room.recorder = recorder = net.connect room.port, ->
......@@ -1319,19 +1332,6 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
room.player_datas.push ip: player.ip, name: player.name
if settings.modules.tips
ygopro.stoc_send_random_tip(client)
if settings.modules.arena_mode.get_score and not client.score_shown
request
url: settings.modules.arena_mode.get_score + encodeURIComponent(client.name),
json: true
, (error, response, body)->
if error or !body or _.isString body
log.warn 'LOAD SCORE ERROR', client.name, error, response.statusCode, response.statusMessage, body
else
log.info 'LOAD SCORE', client.name, body
rank_txt = if body.arena_rank>0 then "排名第" + body.arena_rank else "暂无排名"
ygopro.stoc_send_chat_to_room(room, "#{client.name} #{body.exp}点经验 #{Math.round(body.pt)}点战斗力 #{rank_txt} (正式上线前这些积分可能被重置)", ygopro.constants.COLORS.BABYBLUE)
client.score_shown = true
return
if (settings.modules.enable_deck_log or settings.modules.post_deck) and client.main and client.main.length and not client.deck_saved and client.ip != '::ffff:127.0.0.1'
deck_text = '#ygosrv233 deck log\n#main\n' + client.main.join('\n') + '\n!side\n' + client.side.join('\n') + '\n'
if settings.modules.enable_deck_log
......
......@@ -1310,6 +1310,21 @@
if (room.welcome) {
ygopro.stoc_send_chat(client, room.welcome, ygopro.constants.COLORS.BABYBLUE);
}
if (settings.modules.arena_mode.get_score) {
request({
url: settings.modules.arena_mode.get_score + encodeURIComponent(client.name),
json: true
}, function(error, response, body) {
var rank_txt;
if (error || !body || _.isString(body)) {
log.warn('LOAD SCORE ERROR', client.name, error, response.statusCode, response.statusMessage, body);
} else {
log.info('LOAD SCORE', client.name, body);
rank_txt = body.arena_rank > 0 ? "排名第" + body.arena_rank : "暂无排名";
ygopro.stoc_send_chat(client, client.name + ",你有" + body.exp + "点经验,你的战斗力是" + (Math.round(body.pt)) + "" + rank_txt + "。正式上线前这些积分可能被重置。", ygopro.constants.COLORS.BABYBLUE);
}
});
}
if (!room.recorder) {
room.recorder = recorder = net.connect(room.port, function() {
ygopro.ctos_send(recorder, 'PLAYER_INFO', {
......@@ -1621,22 +1636,6 @@
if (settings.modules.tips) {
ygopro.stoc_send_random_tip(client);
}
if (settings.modules.arena_mode.get_score && !client.score_shown) {
request({
url: settings.modules.arena_mode.get_score + encodeURIComponent(client.name),
json: true
}, function(error, response, body) {
var rank_txt;
if (error || !body || _.isString(body)) {
log.warn('LOAD SCORE ERROR', client.name, error, response.statusCode, response.statusMessage, body);
} else {
log.info('LOAD SCORE', client.name, body);
rank_txt = body.arena_rank > 0 ? "排名第" + body.arena_rank : "暂无排名";
ygopro.stoc_send_chat_to_room(room, client.name + " " + body.exp + "点经验 " + (Math.round(body.pt)) + "点战斗力 " + rank_txt + " (正式上线前这些积分可能被重置)", ygopro.constants.COLORS.BABYBLUE);
client.score_shown = true;
}
});
}
if ((settings.modules.enable_deck_log || settings.modules.post_deck) && client.main && client.main.length && !client.deck_saved && client.ip !== '::ffff:127.0.0.1') {
deck_text = '#ygosrv233 deck log\n#main\n' + client.main.join('\n') + '\n!side\n' + client.side.join('\n') + '\n';
if (settings.modules.enable_deck_log) {
......
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