Commit 6d485627 authored by nanahira's avatar nanahira

merge

parents e6502813 5f586497
...@@ -938,6 +938,7 @@ class Room ...@@ -938,6 +938,7 @@ class Room
@random_type = '' @random_type = ''
@welcome = '' @welcome = ''
@scores = {} @scores = {}
@decks = {}
@duel_count = 0 @duel_count = 0
@death = 0 @death = 0
@turn = 0 @turn = 0
...@@ -1089,7 +1090,10 @@ class Room ...@@ -1089,7 +1090,10 @@ class Room
#log.info 'room-delete', this.name, ROOM_all.length #log.info 'room-delete', this.name, ROOM_all.length
score_array=[] score_array=[]
for name, score of @scores for name, score of @scores
score_array.push { name: name, score: score } score_form = { name: name, score: score, deck: null }
if @decks[name]
score_form.deck = @decks[name]
score_array.push score_form
if settings.modules.arena_mode.enabled and @arena if settings.modules.arena_mode.enabled and @arena
#log.info 'SCORE', score_array, @start_time #log.info 'SCORE', score_array, @start_time
end_time = moment().format() end_time = moment().format()
...@@ -1097,9 +1101,9 @@ class Room ...@@ -1097,9 +1101,9 @@ class Room
@start_time = end_time @start_time = end_time
if score_array.length != 2 if score_array.length != 2
if !score_array[0] if !score_array[0]
score_array[0] = { name: null, score: -5 } score_array[0] = { name: null, score: -5, deck: null }
if !score_array[1] if !score_array[1]
score_array[1] = { name: null, score: -5 } score_array[1] = { name: null, score: -5, deck: null }
score_array[0].score = -5 score_array[0].score = -5
score_array[1].score = -5 score_array[1].score = -5
request.post { url : settings.modules.arena_mode.post_score , form : { request.post { url : settings.modules.arena_mode.post_score , form : {
...@@ -1108,6 +1112,8 @@ class Room ...@@ -1108,6 +1112,8 @@ class Room
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,
userdeckA: score_array[0].deck,
userdeckB: score_array[1].deck,
start: @start_time, start: @start_time,
end: end_time, end: end_time,
arena: @arena arena: @arena
...@@ -1756,6 +1762,9 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1756,6 +1762,9 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
when 4 when 4
room = ROOM_find_or_create_by_name('M#' + info.pass.slice(8)) room = ROOM_find_or_create_by_name('M#' + info.pass.slice(8))
if room if room
for player in room.get_playing_player() when player and player.name == client.name
ygopro.stoc_die(client, '${invalid_password_unauthorized}')
return
room.private = true room.private = true
room.arena = settings.modules.arena_mode.mode room.arena = settings.modules.arena_mode.mode
if room.arena == "athletic" if room.arena == "athletic"
...@@ -2626,8 +2635,11 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)-> ...@@ -2626,8 +2635,11 @@ ygopro.stoc_follow 'DUEL_START', false, (buffer, info, client, server)->
ROOM_players_oppentlist[player.ip] = null ROOM_players_oppentlist[player.ip] = null
if settings.modules.tips.enabled if settings.modules.tips.enabled
ygopro.stoc_send_random_tip(client) ygopro.stoc_send_random_tip(client)
if settings.modules.deck_log.enabled and client.main and client.main.length and not client.deck_saved and not room.windbot deck_text = null
if client.main and client.main.length
deck_text = '#ygopro-server deck log\n#main\n' + client.main.join('\n') + '\n!side\n' + client.side.join('\n') + '\n' deck_text = '#ygopro-server deck log\n#main\n' + client.main.join('\n') + '\n!side\n' + client.side.join('\n') + '\n'
room.decks[client.name] = deck_text
if settings.modules.deck_log.enabled and deck_text and not client.deck_saved and not room.windbot
deck_arena = settings.modules.deck_log.arena + '-' deck_arena = settings.modules.deck_log.arena + '-'
if room.arena if room.arena
deck_arena = deck_arena + room.arena deck_arena = deck_arena + room.arena
......
...@@ -1203,6 +1203,7 @@ ...@@ -1203,6 +1203,7 @@
this.random_type = ''; this.random_type = '';
this.welcome = ''; this.welcome = '';
this.scores = {}; this.scores = {};
this.decks = {};
this.duel_count = 0; this.duel_count = 0;
this.death = 0; this.death = 0;
this.turn = 0; this.turn = 0;
...@@ -1390,7 +1391,7 @@ ...@@ -1390,7 +1391,7 @@
} }
Room.prototype["delete"] = function() { Room.prototype["delete"] = function() {
var end_time, index, log_rep_id, name, player_ips, player_names, recorder_buffer, ref3, replay_id, score, score_array; var end_time, index, log_rep_id, name, player_ips, player_names, recorder_buffer, ref3, replay_id, score, score_array, score_form;
if (this.deleted) { if (this.deleted) {
return; return;
} }
...@@ -1398,10 +1399,15 @@ ...@@ -1398,10 +1399,15 @@
ref3 = this.scores; ref3 = this.scores;
for (name in ref3) { for (name in ref3) {
score = ref3[name]; score = ref3[name];
score_array.push({ score_form = {
name: name, name: name,
score: score score: score,
}); deck: null
};
if (this.decks[name]) {
score_form.deck = this.decks[name];
}
score_array.push(score_form);
} }
if (settings.modules.arena_mode.enabled && this.arena) { if (settings.modules.arena_mode.enabled && this.arena) {
end_time = moment().format(); end_time = moment().format();
...@@ -1412,13 +1418,15 @@ ...@@ -1412,13 +1418,15 @@
if (!score_array[0]) { if (!score_array[0]) {
score_array[0] = { score_array[0] = {
name: null, name: null,
score: -5 score: -5,
deck: null
}; };
} }
if (!score_array[1]) { if (!score_array[1]) {
score_array[1] = { score_array[1] = {
name: null, name: null,
score: -5 score: -5,
deck: null
}; };
} }
score_array[0].score = -5; score_array[0].score = -5;
...@@ -1432,6 +1440,8 @@ ...@@ -1432,6 +1440,8 @@
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,
userdeckA: score_array[0].deck,
userdeckB: score_array[1].deck,
start: this.start_time, start: this.start_time,
end: end_time, end: end_time,
arena: this.arena arena: this.arena
...@@ -2121,7 +2131,7 @@ ...@@ -2121,7 +2131,7 @@
return (checksum & 0xFF) === 0; return (checksum & 0xFF) === 0;
}; };
finish = function(buffer) { finish = function(buffer) {
var action, len2, len3, len4, line, m, n, name, o, opt1, opt2, opt3, options, ref3, ref4, ref5, room, title; var action, len2, len3, len4, len5, line, m, n, name, o, opt1, opt2, opt3, options, p, player, ref3, ref4, ref5, ref6, room, title;
if (client.closed) { if (client.closed) {
return; return;
} }
...@@ -2173,6 +2183,15 @@ ...@@ -2173,6 +2183,15 @@
case 4: case 4:
room = ROOM_find_or_create_by_name('M#' + info.pass.slice(8)); room = ROOM_find_or_create_by_name('M#' + info.pass.slice(8));
if (room) { if (room) {
ref3 = room.get_playing_player();
for (m = 0, len2 = ref3.length; m < len2; m++) {
player = ref3[m];
if (!(player && player.name === client.name)) {
continue;
}
ygopro.stoc_die(client, '${invalid_password_unauthorized}');
return;
}
room["private"] = true; room["private"] = true;
room.arena = settings.modules.arena_mode.mode; room.arena = settings.modules.arena_mode.mode;
if (room.arena === "athletic") { if (room.arena === "athletic") {
...@@ -2203,24 +2222,24 @@ ...@@ -2203,24 +2222,24 @@
client.rid = _.indexOf(ROOM_all, room); client.rid = _.indexOf(ROOM_all, room);
client.is_post_watcher = true; client.is_post_watcher = true;
if (settings.modules.vip.enabled && client.vip && vip_info.players[client.name].words) { if (settings.modules.vip.enabled && client.vip && vip_info.players[client.name].words) {
ref3 = _.lines(vip_info.players[client.name].words); ref4 = _.lines(vip_info.players[client.name].words);
for (m = 0, len2 = ref3.length; m < len2; m++) { for (n = 0, len3 = ref4.length; n < len3; n++) {
line = ref3[m]; line = ref4[n];
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK);
} }
} else if (settings.modules.words.enabled && words.words[client.name]) { } else if (settings.modules.words.enabled && words.words[client.name]) {
ref4 = _.lines(words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]); ref5 = _.lines(words.words[client.name][Math.floor(Math.random() * words.words[client.name].length)]);
for (n = 0, len3 = ref4.length; n < len3; n++) { for (o = 0, len4 = ref5.length; o < len4; o++) {
line = ref4[n]; line = ref5[o];
ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat_to_room(room, line, ygopro.constants.COLORS.PINK);
} }
} }
ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}"); ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}");
room.watchers.push(client); room.watchers.push(client);
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE);
ref5 = room.watcher_buffers; ref6 = room.watcher_buffers;
for (o = 0, len4 = ref5.length; o < len4; o++) { for (p = 0, len5 = ref6.length; p < len5; p++) {
buffer = ref5[o]; buffer = ref6[p];
client.write(buffer); client.write(buffer);
} }
} else { } else {
...@@ -3310,8 +3329,12 @@ ...@@ -3310,8 +3329,12 @@
if (settings.modules.tips.enabled) { if (settings.modules.tips.enabled) {
ygopro.stoc_send_random_tip(client); ygopro.stoc_send_random_tip(client);
} }
if (settings.modules.deck_log.enabled && client.main && client.main.length && !client.deck_saved && !room.windbot) { deck_text = null;
if (client.main && client.main.length) {
deck_text = '#ygopro-server deck log\n#main\n' + client.main.join('\n') + '\n!side\n' + client.side.join('\n') + '\n'; deck_text = '#ygopro-server deck log\n#main\n' + client.main.join('\n') + '\n!side\n' + client.side.join('\n') + '\n';
room.decks[client.name] = deck_text;
}
if (settings.modules.deck_log.enabled && deck_text && !client.deck_saved && !room.windbot) {
deck_arena = settings.modules.deck_log.arena + '-'; deck_arena = settings.modules.deck_log.arena + '-';
if (room.arena) { if (room.arena) {
deck_arena = deck_arena + room.arena; deck_arena = deck_arena + room.arena;
......
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