You need to sign in or sign up before continuing.
Commit 890da55b authored by nanahira's avatar nanahira

test srvpro in ygosharp

parent 5c4550cb
...@@ -18,6 +18,7 @@ config.user.bak ...@@ -18,6 +18,7 @@ config.user.bak
/node_modules /node_modules
/ssl /ssl
/ygosrv233 /ygosrv233
/ygosharp
test* test*
*.heapsnapshot *.heapsnapshot
......
...@@ -131,6 +131,16 @@ ...@@ -131,6 +131,16 @@
"no_connect_count_limit": false, "no_connect_count_limit": false,
"no_ban_player": false "no_ban_player": false
}, },
"ygosharp": {
"enabled": false,
"path": "./ygosharp/",
"param": {
"root": ".",
"database": "cards.cdb",
"lflist": "lflist.conf",
"script": "script"
}
},
"pre_util": { "pre_util": {
"enabled": false, "enabled": false,
"port": 7944, "port": 7944,
......
...@@ -158,6 +158,7 @@ catch ...@@ -158,6 +158,7 @@ catch
setting_save(chat_color) setting_save(chat_color)
try try
throw 1 if settings.modules.ygosharp.enabled
cppversion = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\dABCDEF]+)/)[1], '16') cppversion = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\dABCDEF]+)/)[1], '16')
setting_change(settings, "version", cppversion) setting_change(settings, "version", cppversion)
log.info "ygopro version 0x"+settings.version.toString(16), "(from source code)" log.info "ygopro version 0x"+settings.version.toString(16), "(from source code)"
...@@ -166,6 +167,14 @@ catch ...@@ -166,6 +167,14 @@ catch
log.info "ygopro version 0x"+settings.version.toString(16), "(from config)" log.info "ygopro version 0x"+settings.version.toString(16), "(from config)"
# load the lflist of current date # load the lflist of current date
lflists = [] lflists = []
#ygosharp
if settings.modules.ygosharp.enabled
try
for list in fs.readFileSync(settings.modules.ygosharp.path + '/' + settings.modules.ygosharp.param.lflist, 'utf8').match(/!.*/g)
date=list.match(/!([\d\.]+)/)
continue unless date
lflists.push({date: moment(list.match(/!([\d\.]+)/)[1], 'YYYY.MM.DD').utcOffset("-08:00"), tcg: list.indexOf('TCG') != -1})
catch
# expansions/lflist # expansions/lflist
try try
for list in fs.readFileSync('ygopro/expansions/lflist.conf', 'utf8').match(/!.*/g) for list in fs.readFileSync('ygopro/expansions/lflist.conf', 'utf8').match(/!.*/g)
...@@ -181,7 +190,7 @@ try ...@@ -181,7 +190,7 @@ try
lflists.push({date: moment(list.match(/!([\d\.]+)/)[1], 'YYYY.MM.DD').utcOffset("-08:00"), tcg: list.indexOf('TCG') != -1}) lflists.push({date: moment(list.match(/!([\d\.]+)/)[1], 'YYYY.MM.DD').utcOffset("-08:00"), tcg: list.indexOf('TCG') != -1})
catch catch
if settings.modules.cloud_replay.enabled if settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled
redis = require 'redis' redis = require 'redis'
zlib = require 'zlib' zlib = require 'zlib'
redisdb = redis.createClient host: "127.0.0.1", port: settings.modules.cloud_replay.redis_port redisdb = redis.createClient host: "127.0.0.1", port: settings.modules.cloud_replay.redis_port
...@@ -516,12 +525,40 @@ class Room ...@@ -516,12 +525,40 @@ class Room
if (rule.match /(^|,|,)(IGPRIORITY|PR)(,|,|$)/) if (rule.match /(^|,|,)(IGPRIORITY|PR)(,|,|$)/)
@hostinfo.enable_priority = true @hostinfo.enable_priority = true
param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, (if @hostinfo.enable_priority then 'T' else 'F'), proc_bin_name = './ygopro'
proc_bin_path = 'ygopro'
if settings.modules.ygosharp.enabled
proc_bin_path = settings.modules.ygosharp.path
if /^win/.test(process.platform)
proc_bin_name = './YGOSharp.exe'
param = []
else
proc_bin_name = 'mono'
param = ['./YGOSharp.exe']
param.push('ClientVersion='+settings.version)
param.push('BanlistFile='+settings.modules.ygosharp.param.lflist)
param.push('RootPath='+settings.modules.ygosharp.param.root)
param.push('ScriptDirectory='+settings.modules.ygosharp.param.script)
param.push('DatabaseFile='+settings.modules.ygosharp.param.database)
param.push('Mode='+@hostinfo.mode)
param.push('Region='+@hostinfo.rule)
param.push('BanList='+@hostinfo.lflist)
param.push('StartLp='+@hostinfo.start_lp)
param.push('StartHand='+@hostinfo.start_hand)
param.push('DrawCount='+@hostinfo.draw_count)
param.push('GameTimer='+@hostinfo.time_limit)
param.push('NoCheckDeck='+(if @hostinfo.no_check_deck then 'true' else 'false'))
param.push('NoShuffleDeck='+(if @hostinfo.no_shuffle_deck then 'true' else 'false'))
param.push('MasterRule='+(if @hostinfo.enable_priority then '3' else '4'))
param.push('SRVProMode=true')
param.push('SRVProReplayMode='+@hostinfo.replay_mode)
else
param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, (if @hostinfo.enable_priority then 'T' else 'F'),
(if @hostinfo.no_check_deck then 'T' else 'F'), (if @hostinfo.no_shuffle_deck then 'T' else 'F'), (if @hostinfo.no_check_deck then 'T' else 'F'), (if @hostinfo.no_shuffle_deck then 'T' else 'F'),
@hostinfo.start_lp, @hostinfo.start_hand, @hostinfo.draw_count, @hostinfo.time_limit, @hostinfo.replay_mode] @hostinfo.start_lp, @hostinfo.start_hand, @hostinfo.draw_count, @hostinfo.time_limit, @hostinfo.replay_mode]
try try
@process = spawn './ygopro', param, {cwd: 'ygopro'} @process = spawn proc_bin_name, param, {cwd: proc_bin_path}
@process.on 'error', (err)=> @process.on 'error', (err)=>
_.each @players, (player)-> _.each @players, (player)->
ygopro.stoc_die(player, "${create_room_failed}") ygopro.stoc_die(player, "${create_room_failed}")
...@@ -590,7 +627,7 @@ class Room ...@@ -590,7 +627,7 @@ class Room
#else #else
# log.info 'SCORE POST OK', response.statusCode, response.statusMessage, @name, body # log.info 'SCORE POST OK', response.statusCode, response.statusMessage, @name, body
return return
if @player_datas.length and settings.modules.cloud_replay.enabled if @player_datas.length and settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled
replay_id = @cloud_replay_id replay_id = @cloud_replay_id
if @has_ygopro_error if @has_ygopro_error
log_rep_id = true log_rep_id = true
...@@ -792,7 +829,7 @@ net.createServer (client) -> ...@@ -792,7 +829,7 @@ net.createServer (client) ->
client.destroy() client.destroy()
return return
if settings.modules.cloud_replay.enabled if settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled
client.open_cloud_replay= (err, replay)-> client.open_cloud_replay= (err, replay)->
if err or !replay if err or !replay
ygopro.stoc_die(client, "${cloud_replay_no}") ygopro.stoc_die(client, "${cloud_replay_no}")
...@@ -994,7 +1031,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -994,7 +1031,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if settings.modules.stop if settings.modules.stop
ygopro.stoc_die(client, settings.modules.stop) ygopro.stoc_die(client, settings.modules.stop)
else if info.pass.toUpperCase()=="R" and settings.modules.cloud_replay.enabled else if info.pass.toUpperCase()=="R" and settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled
ygopro.stoc_send_chat(client,"${cloud_replay_hint}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client,"${cloud_replay_hint}", ygopro.constants.COLORS.BABYBLUE)
redisdb.lrange client.ip+":replays", 0, 2, (err, result)-> redisdb.lrange client.ip+":replays", 0, 2, (err, result)->
_.each result, (replay_id,id)-> _.each result, (replay_id,id)->
...@@ -1015,7 +1052,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1015,7 +1052,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client.destroy() client.destroy()
return), 500 return), 500
else if info.pass[0...2].toUpperCase()=="R#" and settings.modules.cloud_replay.enabled else if info.pass[0...2].toUpperCase()=="R#" and settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled
replay_id=info.pass.split("#")[1] replay_id=info.pass.split("#")[1]
if (replay_id>0 and replay_id<=9) if (replay_id>0 and replay_id<=9)
redisdb.lindex client.ip+":replays", replay_id-1, (err, replay_id)-> redisdb.lindex client.ip+":replays", replay_id-1, (err, replay_id)->
...@@ -1030,7 +1067,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1030,7 +1067,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
else else
ygopro.stoc_die(client, "${cloud_replay_no}") ygopro.stoc_die(client, "${cloud_replay_no}")
else if info.pass.toUpperCase()=="W" and settings.modules.cloud_replay.enabled else if info.pass.toUpperCase()=="W" and settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled
replay_id=Cloud_replay_ids[Math.floor(Math.random()*Cloud_replay_ids.length)] replay_id=Cloud_replay_ids[Math.floor(Math.random()*Cloud_replay_ids.length)]
redisdb.hgetall "replay:"+replay_id, client.open_cloud_replay redisdb.hgetall "replay:"+replay_id, client.open_cloud_replay
...@@ -1138,6 +1175,11 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1138,6 +1175,11 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if settings.modules.cloud_replay.enable_halfway_watch if settings.modules.cloud_replay.enable_halfway_watch
client.setTimeout(300000) #连接后超时5分钟 client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room) client.rid = _.indexOf(ROOM_all, room)
if settings.modules.ygosharp.enabled
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
room.connect(client)
return
client.is_post_watcher = true client.is_post_watcher = true
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
...@@ -1248,6 +1290,11 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1248,6 +1290,11 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if settings.modules.cloud_replay.enable_halfway_watch if settings.modules.cloud_replay.enable_halfway_watch
client.setTimeout(300000) #连接后超时5分钟 client.setTimeout(300000) #连接后超时5分钟
client.rid = _.indexOf(ROOM_all, room) client.rid = _.indexOf(ROOM_all, room)
if settings.modules.ygosharp.enabled
ygopro.stoc_send_chat_to_room(room, "#{client.name} ${watch_join}")
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE)
room.connect(client)
return
client.is_post_watcher = true client.is_post_watcher = true
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
...@@ -1286,7 +1333,7 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1286,7 +1333,7 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
#client.score_shown = true #client.score_shown = true
return return
if !room.recorder if !room.recorder and !settings.modules.ygosharp.enabled
room.recorder = recorder = net.connect room.port, -> room.recorder = recorder = net.connect room.port, ->
ygopro.ctos_send recorder, 'PLAYER_INFO', { ygopro.ctos_send recorder, 'PLAYER_INFO', {
name: "Marshtomp" name: "Marshtomp"
...@@ -1300,14 +1347,14 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -1300,14 +1347,14 @@ ygopro.stoc_follow 'JOIN_GAME', false, (buffer, info, client, server)->
recorder.on 'data', (data)-> recorder.on 'data', (data)->
room=ROOM_all[client.rid] room=ROOM_all[client.rid]
return unless room and settings.modules.cloud_replay.enabled return unless room and settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled
room.recorder_buffers.push data room.recorder_buffers.push data
return return
recorder.on 'error', (error)-> recorder.on 'error', (error)->
return return
if settings.modules.cloud_replay.enable_halfway_watch and !room.watcher if settings.modules.cloud_replay.enable_halfway_watch and !settings.modules.ygosharp.enabled and !room.watcher
room.watcher = watcher = if settings.modules.test_mode.watch_public_hand then room.recorder else net.connect room.port, -> room.watcher = watcher = if settings.modules.test_mode.watch_public_hand then room.recorder else net.connect room.port, ->
ygopro.ctos_send watcher, 'PLAYER_INFO', { ygopro.ctos_send watcher, 'PLAYER_INFO', {
name: "the Big Brother" name: "the Big Brother"
...@@ -2080,7 +2127,7 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server)-> ...@@ -2080,7 +2127,7 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server)->
ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)-> ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
room=ROOM_all[client.rid] room=ROOM_all[client.rid]
return settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe unless room return settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe unless room
if settings.modules.cloud_replay.enabled and room.random_type if settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled and !settings.modules.ygosharp.enabled and room.random_type
Cloud_replay_ids.push room.cloud_replay_id Cloud_replay_ids.push room.cloud_replay_id
if settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe if settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe
if client.pos == 0 if client.pos == 0
...@@ -2110,7 +2157,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)-> ...@@ -2110,7 +2157,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server)->
fs.writeFile(settings.modules.tournament_mode.replay_path + replay_filename, buffer, (err)-> fs.writeFile(settings.modules.tournament_mode.replay_path + replay_filename, buffer, (err)->
if err then log.warn "SAVE REPLAY ERROR", replay_filename, err if err then log.warn "SAVE REPLAY ERROR", replay_filename, err
) )
if settings.modules.cloud_replay.enabled if settings.modules.cloud_replay.enabled and !settings.modules.ygosharp.enabled
ygopro.stoc_send_chat(client, "${cloud_replay_delay_part1}R##{room.cloud_replay_id}${cloud_replay_delay_part2}", ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, "${cloud_replay_delay_part1}R##{room.cloud_replay_id}${cloud_replay_delay_part2}", ygopro.constants.COLORS.BABYBLUE)
return settings.modules.tournament_mode.block_replay_to_player return settings.modules.tournament_mode.block_replay_to_player
else else
......
// Generated by CoffeeScript 1.12.7 // Generated by CoffeeScript 1.12.7
(function() { (function() {
var Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_players_banned, ROOM_players_oppentlist, ROOM_unwelcome, ROOM_validate, Room, _, addCallback, badwords, ban_user, bunyan, chat_color, config, cppversion, crypto, date, default_config, default_data, dialogues, duel_log, e, exec, execFile, fs, geoip, get_memory_usage, http, http_server, https, https_server, j, k, len, len1, lflists, list, loadJSON, load_dialogues, load_tips, log, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, ref, ref1, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, tips, url, users_cache, wait_room_start, wait_room_start_arena, windbot_bin, windbot_parameters, windbot_process, windbots, ygopro, zlib; var Cloud_replay_ids, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_port, ROOM_find_by_title, ROOM_find_or_create_ai, ROOM_find_or_create_by_name, ROOM_find_or_create_random, ROOM_players_banned, ROOM_players_oppentlist, ROOM_unwelcome, ROOM_validate, Room, _, addCallback, badwords, ban_user, bunyan, chat_color, config, cppversion, crypto, date, default_config, default_data, dialogues, duel_log, e, exec, execFile, fs, geoip, get_memory_usage, http, http_server, https, https_server, j, k, l, len, len1, len2, lflists, list, loadJSON, load_dialogues, load_tips, log, memory_usage, merge, moment, net, oldbadwords, oldconfig, olddialogues, oldduellog, oldtips, options, os, path, pgClient, pg_client, pg_query, redis, redisdb, ref, ref1, ref2, report_to_big_brother, request, requestListener, roomlist, setting_change, setting_save, settings, spawn, spawnSync, tips, url, users_cache, wait_room_start, wait_room_start_arena, windbot_bin, windbot_parameters, windbot_process, windbots, ygopro, zlib;
net = require('net'); net = require('net');
...@@ -207,6 +207,9 @@ ...@@ -207,6 +207,9 @@
} }
try { try {
if (settings.modules.ygosharp.enabled) {
throw 1;
}
cppversion = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\dABCDEF]+)/)[1], '16'); cppversion = parseInt(fs.readFileSync('ygopro/gframe/game.cpp', 'utf8').match(/PRO_VERSION = ([x\dABCDEF]+)/)[1], '16');
setting_change(settings, "version", cppversion); setting_change(settings, "version", cppversion);
log.info("ygopro version 0x" + settings.version.toString(16), "(from source code)"); log.info("ygopro version 0x" + settings.version.toString(16), "(from source code)");
...@@ -216,10 +219,29 @@ ...@@ -216,10 +219,29 @@
lflists = []; lflists = [];
if (settings.modules.ygosharp.enabled) {
try {
ref = fs.readFileSync(settings.modules.ygosharp.path + '/' + settings.modules.ygosharp.param.lflist, 'utf8').match(/!.*/g);
for (j = 0, len = ref.length; j < len; j++) {
list = ref[j];
date = list.match(/!([\d\.]+)/);
if (!date) {
continue;
}
lflists.push({
date: moment(list.match(/!([\d\.]+)/)[1], 'YYYY.MM.DD').utcOffset("-08:00"),
tcg: list.indexOf('TCG') !== -1
});
}
} catch (error1) {
}
}
try { try {
ref = fs.readFileSync('ygopro/expansions/lflist.conf', 'utf8').match(/!.*/g); ref1 = fs.readFileSync('ygopro/expansions/lflist.conf', 'utf8').match(/!.*/g);
for (j = 0, len = ref.length; j < len; j++) { for (k = 0, len1 = ref1.length; k < len1; k++) {
list = ref[j]; list = ref1[k];
date = list.match(/!([\d\.]+)/); date = list.match(/!([\d\.]+)/);
if (!date) { if (!date) {
continue; continue;
...@@ -234,9 +256,9 @@ ...@@ -234,9 +256,9 @@
} }
try { try {
ref1 = fs.readFileSync('ygopro/lflist.conf', 'utf8').match(/!.*/g); ref2 = fs.readFileSync('ygopro/lflist.conf', 'utf8').match(/!.*/g);
for (k = 0, len1 = ref1.length; k < len1; k++) { for (l = 0, len2 = ref2.length; l < len2; l++) {
list = ref1[k]; list = ref2[l];
date = list.match(/!([\d\.]+)/); date = list.match(/!([\d\.]+)/);
if (!date) { if (!date) {
continue; continue;
...@@ -250,7 +272,7 @@ ...@@ -250,7 +272,7 @@
} }
if (settings.modules.cloud_replay.enabled) { if (settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled) {
redis = require('redis'); redis = require('redis');
zlib = require('zlib'); zlib = require('zlib');
redisdb = redis.createClient({ redisdb = redis.createClient({
...@@ -341,16 +363,16 @@ ...@@ -341,16 +363,16 @@
ROOM_bad_ip = {}; ROOM_bad_ip = {};
ban_user = function(name) { ban_user = function(name) {
var bad_ip, l, len2, len3, m, player, ref2, room; var bad_ip, len3, len4, m, n, player, ref3, room;
settings.ban.banned_user.push(name); settings.ban.banned_user.push(name);
setting_save(settings); setting_save(settings);
bad_ip = 0; bad_ip = 0;
for (l = 0, len2 = ROOM_all.length; l < len2; l++) { for (m = 0, len3 = ROOM_all.length; m < len3; m++) {
room = ROOM_all[l]; room = ROOM_all[m];
if (room && room.established) { if (room && room.established) {
ref2 = room.players; ref3 = room.players;
for (m = 0, len3 = ref2.length; m < len3; m++) { for (n = 0, len4 = ref3.length; n < len4; n++) {
player = ref2[m]; player = ref3[n];
if (player && (player.name === name || player.ip === bad_ip)) { if (player && (player.name === name || player.ip === bad_ip)) {
bad_ip = player.ip; bad_ip = player.ip;
ROOM_bad_ip[bad_ip] = 99; ROOM_bad_ip[bad_ip] = 99;
...@@ -546,13 +568,13 @@ ...@@ -546,13 +568,13 @@
}; };
ROOM_unwelcome = function(room, bad_player, reason) { ROOM_unwelcome = function(room, bad_player, reason) {
var l, len2, player, ref2; var len3, m, player, ref3;
if (!room) { if (!room) {
return; return;
} }
ref2 = room.players; ref3 = room.players;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref2[l]; player = ref3[m];
if (player && player === bad_player) { if (player && player === bad_player) {
ygopro.stoc_send_chat(player, "${unwelcome_warn_part1}" + reason + "${unwelcome_warn_part2}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(player, "${unwelcome_warn_part1}" + reason + "${unwelcome_warn_part2}", ygopro.constants.COLORS.RED);
} else if (player && player.pos !== 7 && player !== bad_player) { } else if (player && player.pos !== 7 && player !== bad_player) {
...@@ -564,7 +586,7 @@ ...@@ -564,7 +586,7 @@
Room = (function() { Room = (function() {
function Room(name, hostinfo) { function Room(name, hostinfo) {
var draw_count, lflist, param, rule, start_hand, start_lp, time_limit; var draw_count, lflist, param, proc_bin_name, proc_bin_path, rule, start_hand, start_lp, time_limit;
this.hostinfo = hostinfo; this.hostinfo = hostinfo;
this.name = name; this.name = name;
this.alive = true; this.alive = true;
...@@ -692,10 +714,40 @@ ...@@ -692,10 +714,40 @@
this.hostinfo.enable_priority = true; this.hostinfo.enable_priority = true;
} }
} }
param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, (this.hostinfo.enable_priority ? 'T' : 'F'), (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit, this.hostinfo.replay_mode]; proc_bin_name = './ygopro';
proc_bin_path = 'ygopro';
if (settings.modules.ygosharp.enabled) {
proc_bin_path = settings.modules.ygosharp.path;
if (/^win/.test(process.platform)) {
proc_bin_name = './YGOSharp.exe';
param = [];
} else {
proc_bin_name = 'mono';
param = ['./YGOSharp.exe'];
}
param.push('ClientVersion=' + settings.version);
param.push('BanlistFile=' + settings.modules.ygosharp.param.lflist);
param.push('RootPath=' + settings.modules.ygosharp.param.root);
param.push('ScriptDirectory=' + settings.modules.ygosharp.param.script);
param.push('DatabaseFile=' + settings.modules.ygosharp.param.database);
param.push('Mode=' + this.hostinfo.mode);
param.push('Region=' + this.hostinfo.rule);
param.push('BanList=' + this.hostinfo.lflist);
param.push('StartLp=' + this.hostinfo.start_lp);
param.push('StartHand=' + this.hostinfo.start_hand);
param.push('DrawCount=' + this.hostinfo.draw_count);
param.push('GameTimer=' + this.hostinfo.time_limit);
param.push('NoCheckDeck=' + (this.hostinfo.no_check_deck ? 'true' : 'false'));
param.push('NoShuffleDeck=' + (this.hostinfo.no_shuffle_deck ? 'true' : 'false'));
param.push('MasterRule=' + (this.hostinfo.enable_priority ? '3' : '4'));
param.push('SRVProMode=true');
param.push('SRVProReplayMode=' + this.hostinfo.replay_mode);
} else {
param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, (this.hostinfo.enable_priority ? 'T' : 'F'), (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit, this.hostinfo.replay_mode];
}
try { try {
this.process = spawn('./ygopro', param, { this.process = spawn(proc_bin_name, param, {
cwd: 'ygopro' cwd: proc_bin_path
}); });
this.process.on('error', (function(_this) { this.process.on('error', (function(_this) {
return function(err) { return function(err) {
...@@ -723,10 +775,10 @@ ...@@ -723,10 +775,10 @@
_this.port = parseInt(data); _this.port = parseInt(data);
_.each(_this.players, function(player) { _.each(_this.players, function(player) {
player.server.connect(_this.port, '127.0.0.1', function() { player.server.connect(_this.port, '127.0.0.1', function() {
var buffer, l, len2, ref2; var buffer, len3, m, ref3;
ref2 = player.pre_establish_buffers; ref3 = player.pre_establish_buffers;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
buffer = ref2[l]; buffer = ref3[m];
player.server.write(buffer); player.server.write(buffer);
} }
player.established = true; player.established = true;
...@@ -759,14 +811,14 @@ ...@@ -759,14 +811,14 @@
} }
Room.prototype["delete"] = function() { Room.prototype["delete"] = function() {
var end_time, index, log_rep_id, name, player_ips, player_names, recorder_buffer, ref2, 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;
if (this.deleted) { if (this.deleted) {
return; return;
} }
score_array = []; score_array = [];
ref2 = this.scores; ref3 = this.scores;
for (name in ref2) { for (name in ref3) {
score = ref2[name]; score = ref3[name];
score_array.push({ score_array.push({
name: name, name: name,
score: score score: score
...@@ -803,7 +855,7 @@ ...@@ -803,7 +855,7 @@
})(this)); })(this));
} }
} }
if (this.player_datas.length && settings.modules.cloud_replay.enabled) { if (this.player_datas.length && settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled) {
replay_id = this.cloud_replay_id; replay_id = this.cloud_replay_id;
if (this.has_ygopro_error) { if (this.has_ygopro_error) {
log_rep_id = true; log_rep_id = true;
...@@ -908,10 +960,10 @@ ...@@ -908,10 +960,10 @@
roomlist.update(this); roomlist.update(this);
} }
client.server.connect(this.port, '127.0.0.1', function() { client.server.connect(this.port, '127.0.0.1', function() {
var buffer, l, len2, ref2; var buffer, len3, m, ref3;
ref2 = client.pre_establish_buffers; ref3 = client.pre_establish_buffers;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
buffer = ref2[l]; buffer = ref3[m];
client.server.write(buffer); client.server.write(buffer);
} }
client.established = true; client.established = true;
...@@ -921,7 +973,7 @@ ...@@ -921,7 +973,7 @@
}; };
Room.prototype.disconnect = function(client, error) { Room.prototype.disconnect = function(client, error) {
var index, l, len2, player, ref2; var index, len3, m, player, ref3;
if (client.is_post_watcher) { if (client.is_post_watcher) {
ygopro.stoc_send_chat_to_room(this, (client.name + " ${quit_watch}") + (error ? ": " + error : '')); ygopro.stoc_send_chat_to_room(this, (client.name + " ${quit_watch}") + (error ? ": " + error : ''));
index = _.indexOf(this.watchers, client); index = _.indexOf(this.watchers, client);
...@@ -930,9 +982,9 @@ ...@@ -930,9 +982,9 @@
} }
} else { } else {
if (this.arena === "athletic" && !this.started && this.players.length === 2) { if (this.arena === "athletic" && !this.started && this.players.length === 2) {
ref2 = this.players; ref3 = this.players;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref2[l]; player = ref3[m];
if (player.pos !== 7) { if (player.pos !== 7) {
this.scores[player.name] = 0; this.scores[player.name] = 0;
} }
...@@ -1044,7 +1096,7 @@ ...@@ -1044,7 +1096,7 @@
client.destroy(); client.destroy();
return; return;
} }
if (settings.modules.cloud_replay.enabled) { if (settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled) {
client.open_cloud_replay = function(err, replay) { client.open_cloud_replay = function(err, replay) {
var buffer; var buffer;
if (err || !replay) { if (err || !replay) {
...@@ -1069,7 +1121,7 @@ ...@@ -1069,7 +1121,7 @@
} }
client.pre_establish_buffers = new Array(); client.pre_establish_buffers = new Array();
client.on('data', function(ctos_buffer) { client.on('data', function(ctos_buffer) {
var b, bad_ip_count, buffer, cancel, ctos_message_length, ctos_proto, datas, info, l, len2, len3, looplimit, m, room, struct; var b, bad_ip_count, buffer, cancel, ctos_message_length, ctos_proto, datas, info, len3, len4, looplimit, m, n, room, struct;
if (client.is_post_watcher) { if (client.is_post_watcher) {
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (room) { if (room) {
...@@ -1140,20 +1192,20 @@ ...@@ -1140,20 +1192,20 @@
} }
} }
if (client.established) { if (client.established) {
for (l = 0, len2 = datas.length; l < len2; l++) { for (m = 0, len3 = datas.length; m < len3; m++) {
buffer = datas[l]; buffer = datas[m];
server.write(buffer); server.write(buffer);
} }
} else { } else {
for (m = 0, len3 = datas.length; m < len3; m++) { for (n = 0, len4 = datas.length; n < len4; n++) {
buffer = datas[m]; buffer = datas[n];
client.pre_establish_buffers.push(buffer); client.pre_establish_buffers.push(buffer);
} }
} }
} }
}); });
server.on('data', function(stoc_buffer) { server.on('data', function(stoc_buffer) {
var b, buffer, cancel, datas, info, l, len2, looplimit, stanzas, stoc_message_length, stoc_proto, struct; var b, buffer, cancel, datas, info, len3, looplimit, m, stanzas, stoc_message_length, stoc_proto, struct;
stoc_message_length = 0; stoc_message_length = 0;
stoc_proto = 0; stoc_proto = 0;
datas = []; datas = [];
...@@ -1210,8 +1262,8 @@ ...@@ -1210,8 +1262,8 @@
break; break;
} }
} }
for (l = 0, len2 = datas.length; l < len2; l++) { for (m = 0, len3 = datas.length; m < len3; m++) {
buffer = datas[l]; buffer = datas[m];
client.write(buffer); client.write(buffer);
} }
}); });
...@@ -1262,11 +1314,11 @@ ...@@ -1262,11 +1314,11 @@
}); });
ygopro.ctos_follow('JOIN_GAME', false, function(buffer, info, client, server) { ygopro.ctos_follow('JOIN_GAME', false, function(buffer, info, client, server) {
var check, decrypted_buffer, finish, i, id, l, len2, len3, m, name, ref2, ref3, replay_id, room, secret; var check, decrypted_buffer, finish, i, id, len3, len4, m, n, name, ref3, ref4, replay_id, room, secret;
info.pass = info.pass.trim(); info.pass = info.pass.trim();
if (settings.modules.stop) { if (settings.modules.stop) {
ygopro.stoc_die(client, settings.modules.stop); ygopro.stoc_die(client, settings.modules.stop);
} else if (info.pass.toUpperCase() === "R" && settings.modules.cloud_replay.enabled) { } else if (info.pass.toUpperCase() === "R" && settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled) {
ygopro.stoc_send_chat(client, "${cloud_replay_hint}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${cloud_replay_hint}", ygopro.constants.COLORS.BABYBLUE);
redisdb.lrange(client.ip + ":replays", 0, 2, function(err, result) { redisdb.lrange(client.ip + ":replays", 0, 2, function(err, result) {
_.each(result, function(replay_id, id) { _.each(result, function(replay_id, id) {
...@@ -1288,7 +1340,7 @@ ...@@ -1288,7 +1340,7 @@
}); });
client.destroy(); client.destroy();
}), 500); }), 500);
} else if (info.pass.slice(0, 2).toUpperCase() === "R#" && settings.modules.cloud_replay.enabled) { } else if (info.pass.slice(0, 2).toUpperCase() === "R#" && settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled) {
replay_id = info.pass.split("#")[1]; replay_id = info.pass.split("#")[1];
if (replay_id > 0 && replay_id <= 9) { if (replay_id > 0 && replay_id <= 9) {
redisdb.lindex(client.ip + ":replays", replay_id - 1, function(err, replay_id) { redisdb.lindex(client.ip + ":replays", replay_id - 1, function(err, replay_id) {
...@@ -1306,7 +1358,7 @@ ...@@ -1306,7 +1358,7 @@
} else { } else {
ygopro.stoc_die(client, "${cloud_replay_no}"); ygopro.stoc_die(client, "${cloud_replay_no}");
} }
} else if (info.pass.toUpperCase() === "W" && settings.modules.cloud_replay.enabled) { } else if (info.pass.toUpperCase() === "W" && settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled) {
replay_id = Cloud_replay_ids[Math.floor(Math.random() * Cloud_replay_ids.length)]; replay_id = Cloud_replay_ids[Math.floor(Math.random() * Cloud_replay_ids.length)];
redisdb.hgetall("replay:" + replay_id, client.open_cloud_replay); redisdb.hgetall("replay:" + replay_id, client.open_cloud_replay);
} else if (info.version !== settings.version) { } else if (info.version !== settings.version) {
...@@ -1330,15 +1382,15 @@ ...@@ -1330,15 +1382,15 @@
return; return;
} }
check = function(buf) { check = function(buf) {
var checksum, i, l, ref2; var checksum, i, m, ref3;
checksum = 0; checksum = 0;
for (i = l = 0, ref2 = buf.length; 0 <= ref2 ? l < ref2 : l > ref2; i = 0 <= ref2 ? ++l : --l) { for (i = m = 0, ref3 = buf.length; 0 <= ref3 ? m < ref3 : m > ref3; i = 0 <= ref3 ? ++m : --m) {
checksum += buf.readUInt8(i); checksum += buf.readUInt8(i);
} }
return (checksum & 0xFF) === 0; return (checksum & 0xFF) === 0;
}; };
finish = function(buffer) { finish = function(buffer) {
var action, l, len2, name, opt1, opt2, opt3, options, ref2, room, title; var action, len3, m, name, opt1, opt2, opt3, options, ref3, room, title;
action = buffer.readUInt8(1) >> 4; action = buffer.readUInt8(1) >> 4;
if (buffer !== decrypted_buffer && (action === 1 || action === 2 || action === 4)) { if (buffer !== decrypted_buffer && (action === 1 || action === 2 || action === 4)) {
ygopro.stoc_die(client, '${invalid_password_unauthorized}'); ygopro.stoc_die(client, '${invalid_password_unauthorized}');
...@@ -1411,13 +1463,19 @@ ...@@ -1411,13 +1463,19 @@
if (settings.modules.cloud_replay.enable_halfway_watch) { if (settings.modules.cloud_replay.enable_halfway_watch) {
client.setTimeout(300000); client.setTimeout(300000);
client.rid = _.indexOf(ROOM_all, room); client.rid = _.indexOf(ROOM_all, room);
if (settings.modules.ygosharp.enabled) {
ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}");
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE);
room.connect(client);
return;
}
client.is_post_watcher = true; client.is_post_watcher = true;
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);
ref2 = room.watcher_buffers; ref3 = room.watcher_buffers;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
buffer = ref2[l]; buffer = ref3[m];
client.write(buffer); client.write(buffer);
} }
} else { } else {
...@@ -1432,9 +1490,9 @@ ...@@ -1432,9 +1490,9 @@
if (id = users_cache[client.name]) { if (id = users_cache[client.name]) {
secret = id % 65535 + 1; secret = id % 65535 + 1;
decrypted_buffer = new Buffer(6); decrypted_buffer = new Buffer(6);
ref2 = [0, 2, 4]; ref3 = [0, 2, 4];
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
i = ref2[l]; i = ref3[m];
decrypted_buffer.writeUInt16LE(buffer.readUInt16LE(i) ^ secret, i); decrypted_buffer.writeUInt16LE(buffer.readUInt16LE(i) ^ secret, i);
} }
if (check(decrypted_buffer)) { if (check(decrypted_buffer)) {
...@@ -1451,14 +1509,14 @@ ...@@ -1451,14 +1509,14 @@
}, },
json: true json: true
}, function(error, response, body) { }, function(error, response, body) {
var len3, m, ref3; var len4, n, ref4;
if (body && body.user) { if (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 = new Buffer(6); decrypted_buffer = new Buffer(6);
ref3 = [0, 2, 4]; ref4 = [0, 2, 4];
for (m = 0, len3 = ref3.length; m < len3; m++) { for (n = 0, len4 = ref4.length; n < len4; n++) {
i = ref3[m]; i = ref4[n];
decrypted_buffer.writeUInt16LE(buffer.readUInt16LE(i) ^ secret, i); decrypted_buffer.writeUInt16LE(buffer.readUInt16LE(i) ^ secret, i);
} }
if (check(decrypted_buffer)) { if (check(decrypted_buffer)) {
...@@ -1517,13 +1575,19 @@ ...@@ -1517,13 +1575,19 @@
if (settings.modules.cloud_replay.enable_halfway_watch) { if (settings.modules.cloud_replay.enable_halfway_watch) {
client.setTimeout(300000); client.setTimeout(300000);
client.rid = _.indexOf(ROOM_all, room); client.rid = _.indexOf(ROOM_all, room);
if (settings.modules.ygosharp.enabled) {
ygopro.stoc_send_chat_to_room(room, client.name + " ${watch_join}");
ygopro.stoc_send_chat(client, "${watch_watching}", ygopro.constants.COLORS.BABYBLUE);
room.connect(client);
return;
}
client.is_post_watcher = true; client.is_post_watcher = true;
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);
ref3 = room.watcher_buffers; ref4 = room.watcher_buffers;
for (m = 0, len3 = ref3.length; m < len3; m++) { for (n = 0, len4 = ref4.length; n < len4; n++) {
buffer = ref3[m]; buffer = ref4[n];
client.write(buffer); client.write(buffer);
} }
} else { } else {
...@@ -1565,7 +1629,7 @@ ...@@ -1565,7 +1629,7 @@
} }
}); });
} }
if (!room.recorder) { if (!room.recorder && !settings.modules.ygosharp.enabled) {
room.recorder = recorder = net.connect(room.port, function() { room.recorder = recorder = net.connect(room.port, function() {
ygopro.ctos_send(recorder, 'PLAYER_INFO', { ygopro.ctos_send(recorder, 'PLAYER_INFO', {
name: "Marshtomp" name: "Marshtomp"
...@@ -1578,14 +1642,14 @@ ...@@ -1578,14 +1642,14 @@
}); });
recorder.on('data', function(data) { recorder.on('data', function(data) {
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!(room && settings.modules.cloud_replay.enabled)) { if (!(room && settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled)) {
return; return;
} }
room.recorder_buffers.push(data); room.recorder_buffers.push(data);
}); });
recorder.on('error', function(error) {}); recorder.on('error', function(error) {});
} }
if (settings.modules.cloud_replay.enable_halfway_watch && !room.watcher) { if (settings.modules.cloud_replay.enable_halfway_watch && !settings.modules.ygosharp.enabled && !room.watcher) {
room.watcher = watcher = settings.modules.test_mode.watch_public_hand ? room.recorder : net.connect(room.port, function() { room.watcher = watcher = settings.modules.test_mode.watch_public_hand ? room.recorder : net.connect(room.port, function() {
ygopro.ctos_send(watcher, 'PLAYER_INFO', { ygopro.ctos_send(watcher, 'PLAYER_INFO', {
name: "the Big Brother" name: "the Big Brother"
...@@ -1597,15 +1661,15 @@ ...@@ -1597,15 +1661,15 @@
ygopro.ctos_send(watcher, 'HS_TOOBSERVER'); ygopro.ctos_send(watcher, 'HS_TOOBSERVER');
}); });
watcher.on('data', function(data) { watcher.on('data', function(data) {
var l, len2, ref2, w; var len3, m, ref3, w;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
} }
room.watcher_buffers.push(data); room.watcher_buffers.push(data);
ref2 = room.watchers; ref3 = room.watchers;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
w = ref2[l]; w = ref3[m];
if (w) { if (w) {
w.write(data); w.write(data);
} }
...@@ -1636,7 +1700,7 @@ ...@@ -1636,7 +1700,7 @@
} }
ygopro.stoc_follow('GAME_MSG', true, function(buffer, info, client, server) { ygopro.stoc_follow('GAME_MSG', true, function(buffer, info, client, server) {
var card, count, l, len2, line, loc, msg, oppo_pos, phase, playertype, pos, reason, ref2, ref3, ref4, room, trigger_location, val, win_pos; var card, count, len3, line, loc, m, msg, oppo_pos, phase, playertype, pos, reason, ref3, ref4, ref5, room, trigger_location, val, win_pos;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
...@@ -1785,7 +1849,7 @@ ...@@ -1785,7 +1849,7 @@
if (room.dueling_players[pos].lp < 0) { if (room.dueling_players[pos].lp < 0) {
room.dueling_players[pos].lp = 0; room.dueling_players[pos].lp = 0;
} }
if ((0 < (ref2 = room.dueling_players[pos].lp) && ref2 <= 100)) { if ((0 < (ref3 = room.dueling_players[pos].lp) && ref3 <= 100)) {
ygopro.stoc_send_chat_to_room(room, "${lp_low_opponent}", ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat_to_room(room, "${lp_low_opponent}", ygopro.constants.COLORS.PINK);
} }
} }
...@@ -1824,7 +1888,7 @@ ...@@ -1824,7 +1888,7 @@
if (room.dueling_players[pos].lp < 0) { if (room.dueling_players[pos].lp < 0) {
room.dueling_players[pos].lp = 0; room.dueling_players[pos].lp = 0;
} }
if ((0 < (ref3 = room.dueling_players[pos].lp) && ref3 <= 100)) { if ((0 < (ref4 = room.dueling_players[pos].lp) && ref4 <= 100)) {
ygopro.stoc_send_chat_to_room(room, "${lp_low_self}", ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat_to_room(room, "${lp_low_self}", ygopro.constants.COLORS.PINK);
} }
} }
...@@ -1861,9 +1925,9 @@ ...@@ -1861,9 +1925,9 @@
card = buffer.readUInt32LE(1); card = buffer.readUInt32LE(1);
trigger_location = buffer.readUInt8(6); trigger_location = buffer.readUInt8(6);
if (dialogues.dialogues[card] && (ygopro.constants.MSG[msg] !== 'CHAINING' || (trigger_location & 0x8) && !(trigger_location & 0x200))) { if (dialogues.dialogues[card] && (ygopro.constants.MSG[msg] !== 'CHAINING' || (trigger_location & 0x8) && !(trigger_location & 0x200))) {
ref4 = _.lines(dialogues.dialogues[card][Math.floor(Math.random() * dialogues.dialogues[card].length)]); ref5 = _.lines(dialogues.dialogues[card][Math.floor(Math.random() * dialogues.dialogues[card].length)]);
for (l = 0, len2 = ref4.length; l < len2; l++) { for (m = 0, len3 = ref5.length; m < len3; m++) {
line = ref4[l]; line = ref5[m];
ygopro.stoc_send_chat(client, line, ygopro.constants.COLORS.PINK); ygopro.stoc_send_chat(client, line, ygopro.constants.COLORS.PINK);
} }
} }
...@@ -1873,7 +1937,7 @@ ...@@ -1873,7 +1937,7 @@
}); });
ygopro.ctos_follow('HS_TOOBSERVER', true, function(buffer, info, client, server) { ygopro.ctos_follow('HS_TOOBSERVER', true, function(buffer, info, client, server) {
var l, len2, player, ref2, room; var len3, m, player, ref3, room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
...@@ -1881,9 +1945,9 @@ ...@@ -1881,9 +1945,9 @@
if (!room.arena || client.is_local) { if (!room.arena || client.is_local) {
return false; return false;
} }
ref2 = room.players; ref3 = room.players;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref2[l]; player = ref3[m];
if (player === client) { if (player === client) {
ygopro.stoc_send_chat(client, "${cannot_to_observer}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${cannot_to_observer}", ygopro.constants.COLORS.BABYBLUE);
return true; return true;
...@@ -1893,14 +1957,14 @@ ...@@ -1893,14 +1957,14 @@
}); });
ygopro.ctos_follow('HS_KICK', true, function(buffer, info, client, server) { ygopro.ctos_follow('HS_KICK', true, function(buffer, info, client, server) {
var l, len2, player, ref2, room; var len3, m, player, ref3, room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
} }
ref2 = room.players; ref3 = room.players;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref2[l]; player = ref3[m];
if (player && player.pos === info.pos && player !== client) { if (player && player.pos === info.pos && player !== client) {
if (room.arena === "athletic") { if (room.arena === "athletic") {
ygopro.stoc_send_chat_to_room(room, client.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, client.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
...@@ -1929,7 +1993,7 @@ ...@@ -1929,7 +1993,7 @@
}); });
ygopro.stoc_follow('HS_PLAYER_CHANGE', false, function(buffer, info, client, server) { ygopro.stoc_follow('HS_PLAYER_CHANGE', false, function(buffer, info, client, server) {
var is_ready, l, len2, len3, m, p1, p2, player, pos, ref2, ref3, room; var is_ready, len3, len4, m, n, p1, p2, player, pos, ref3, ref4, room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!(room && room.max_player && client.is_host)) { if (!(room && room.max_player && client.is_host)) {
return; return;
...@@ -1939,9 +2003,9 @@ ...@@ -1939,9 +2003,9 @@
if (pos < room.max_player) { if (pos < room.max_player) {
if (room.arena) { if (room.arena) {
room.ready_player_count = 0; room.ready_player_count = 0;
ref2 = room.players; ref3 = room.players;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref2[l]; player = ref3[m];
if (player.pos === pos) { if (player.pos === pos) {
player.is_ready = is_ready; player.is_ready = is_ready;
} }
...@@ -1979,9 +2043,9 @@ ...@@ -1979,9 +2043,9 @@
} }
} else { } else {
room.ready_player_count_without_host = 0; room.ready_player_count_without_host = 0;
ref3 = room.players; ref4 = room.players;
for (m = 0, len3 = ref3.length; m < len3; m++) { for (n = 0, len4 = ref4.length; n < len4; n++) {
player = ref3[m]; player = ref4[n];
if (player.pos === pos) { if (player.pos === pos) {
player.is_ready = is_ready; player.is_ready = is_ready;
} }
...@@ -1999,7 +2063,7 @@ ...@@ -1999,7 +2063,7 @@
}); });
wait_room_start = function(room, time) { wait_room_start = function(room, time) {
var l, len2, player, ref2; var len3, m, player, ref3;
if (!(!room || room.started || room.ready_player_count_without_host < room.max_player - 1)) { if (!(!room || room.started || room.ready_player_count_without_host < room.max_player - 1)) {
time -= 1; time -= 1;
if (time) { if (time) {
...@@ -2010,9 +2074,9 @@ ...@@ -2010,9 +2074,9 @@
wait_room_start(room, time); wait_room_start(room, time);
}), 1000); }), 1000);
} else { } else {
ref2 = room.players; ref3 = room.players;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref2[l]; player = ref3[m];
if (player && player.is_host) { if (player && player.is_host) {
ROOM_ban_player(player.name, player.ip, "${random_ban_reason_zombie}"); ROOM_ban_player(player.name, player.ip, "${random_ban_reason_zombie}");
ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
...@@ -2072,9 +2136,9 @@ ...@@ -2072,9 +2136,9 @@
if (settings.modules.tips.get) { if (settings.modules.tips.get) {
load_tips(); load_tips();
setInterval(function() { setInterval(function() {
var l, len2, room; var len3, m, room;
for (l = 0, len2 = ROOM_all.length; l < len2; l++) { for (m = 0, len3 = ROOM_all.length; m < len3; m++) {
room = ROOM_all[l]; room = ROOM_all[m];
if (room && room.established) { if (room && room.established) {
if (!room.started || room.changing_side) { if (!room.started || room.changing_side) {
ygopro.stoc_send_random_tip_to_room(room); ygopro.stoc_send_random_tip_to_room(room);
...@@ -2085,7 +2149,7 @@ ...@@ -2085,7 +2149,7 @@
} }
ygopro.stoc_follow('DUEL_START', false, function(buffer, info, client, server) { ygopro.stoc_follow('DUEL_START', false, function(buffer, info, client, server) {
var deck_arena, deck_name, deck_text, l, len2, player, ref2, room; var deck_arena, deck_name, deck_text, len3, m, player, ref3, room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
...@@ -2097,9 +2161,9 @@ ...@@ -2097,9 +2161,9 @@
roomlist.start(room); roomlist.start(room);
} }
room.dueling_players = []; room.dueling_players = [];
ref2 = room.players; ref3 = room.players;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref2[l]; player = ref3[m];
if (!(player.pos !== 7)) { if (!(player.pos !== 7)) {
continue; continue;
} }
...@@ -2205,7 +2269,7 @@ ...@@ -2205,7 +2269,7 @@
}; };
ygopro.ctos_follow('CHAT', true, function(buffer, info, client, server) { ygopro.ctos_follow('CHAT', true, function(buffer, info, client, server) {
var cancel, ccolor, cip, cmd, cmsg, cname, color, cvalue, msg, name, oldmsg, ref2, room, struct, windbot; var cancel, ccolor, cip, cmd, cmsg, cname, color, cvalue, msg, name, oldmsg, ref3, room, struct, windbot;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
...@@ -2284,9 +2348,9 @@ ...@@ -2284,9 +2348,9 @@
if (cmsg = cmd[1]) { if (cmsg = cmd[1]) {
if (cmsg.toLowerCase() === "help") { if (cmsg.toLowerCase() === "help") {
ygopro.stoc_send_chat(client, "${show_color_list}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${show_color_list}", ygopro.constants.COLORS.BABYBLUE);
ref2 = ygopro.constants.COLORS; ref3 = ygopro.constants.COLORS;
for (cname in ref2) { for (cname in ref3) {
cvalue = ref2[cname]; cvalue = ref3[cname];
if (cvalue > 10) { if (cvalue > 10) {
ygopro.stoc_send_chat(client, cname, cvalue); ygopro.stoc_send_chat(client, cname, cvalue);
} }
...@@ -2405,23 +2469,23 @@ ...@@ -2405,23 +2469,23 @@
}); });
ygopro.ctos_follow('UPDATE_DECK', true, function(buffer, info, client, server) { ygopro.ctos_follow('UPDATE_DECK', true, function(buffer, info, client, server) {
var buff_main, buff_side, card, current_deck, deck, deck_array, deck_main, deck_side, deck_text, deckbuf, decks, found_deck, i, l, len2, len3, line, m, oppo_pos, room, struct, win_pos; var buff_main, buff_side, card, current_deck, deck, deck_array, deck_main, deck_side, deck_text, deckbuf, decks, found_deck, i, len3, len4, line, m, n, oppo_pos, room, struct, win_pos;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return false; return false;
} }
buff_main = (function() { buff_main = (function() {
var l, ref2, results; var m, ref3, results;
results = []; results = [];
for (i = l = 0, ref2 = info.mainc; 0 <= ref2 ? l < ref2 : l > ref2; i = 0 <= ref2 ? ++l : --l) { for (i = m = 0, ref3 = info.mainc; 0 <= ref3 ? m < ref3 : m > ref3; i = 0 <= ref3 ? ++m : --m) {
results.push(info.deckbuf[i]); results.push(info.deckbuf[i]);
} }
return results; return results;
})(); })();
buff_side = (function() { buff_side = (function() {
var l, ref2, ref3, results; var m, ref3, ref4, results;
results = []; results = [];
for (i = l = ref2 = info.mainc, ref3 = info.mainc + info.sidec; ref2 <= ref3 ? l < ref3 : l > ref3; i = ref2 <= ref3 ? ++l : --l) { for (i = m = ref3 = info.mainc, ref4 = info.mainc + info.sidec; ref3 <= ref4 ? m < ref4 : m > ref4; i = ref3 <= ref4 ? ++m : --m) {
results.push(info.deckbuf[i]); results.push(info.deckbuf[i]);
} }
return results; return results;
...@@ -2462,8 +2526,8 @@ ...@@ -2462,8 +2526,8 @@
buffer = struct.buffer; buffer = struct.buffer;
found_deck = false; found_deck = false;
decks = fs.readdirSync(settings.modules.tournament_mode.deck_path); decks = fs.readdirSync(settings.modules.tournament_mode.deck_path);
for (l = 0, len2 = decks.length; l < len2; l++) { for (m = 0, len3 = decks.length; m < len3; m++) {
deck = decks[l]; deck = decks[m];
if (_.endsWith(deck, client.name + ".ydk")) { if (_.endsWith(deck, client.name + ".ydk")) {
found_deck = deck; found_deck = deck;
} }
...@@ -2479,8 +2543,8 @@ ...@@ -2479,8 +2543,8 @@
deck_main = []; deck_main = [];
deck_side = []; deck_side = [];
current_deck = deck_main; current_deck = deck_main;
for (m = 0, len3 = deck_array.length; m < len3; m++) { for (n = 0, len4 = deck_array.length; n < len4; n++) {
line = deck_array[m]; line = deck_array[n];
if (line.indexOf("!side") >= 0) { if (line.indexOf("!side") >= 0) {
current_deck = deck_side; current_deck = deck_side;
} }
...@@ -2537,7 +2601,7 @@ ...@@ -2537,7 +2601,7 @@
}); });
ygopro.stoc_follow('CHAT', true, function(buffer, info, client, server) { ygopro.stoc_follow('CHAT', true, function(buffer, info, client, server) {
var l, len2, pid, player, ref2, room, tcolor, tplayer; var len3, m, pid, player, ref3, room, tcolor, tplayer;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
pid = info.player; pid = info.player;
if (!(room && pid < 4 && settings.modules.chat_color.enabled)) { if (!(room && pid < 4 && settings.modules.chat_color.enabled)) {
...@@ -2555,9 +2619,9 @@ ...@@ -2555,9 +2619,9 @@
pid = 1 - pid; pid = 1 - pid;
} }
} }
ref2 = room.players; ref3 = room.players;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
player = ref2[l]; player = ref3[m];
if (player && player.pos === pid) { if (player && player.pos === pid) {
tplayer = player; tplayer = player;
} }
...@@ -2641,12 +2705,12 @@ ...@@ -2641,12 +2705,12 @@
}); });
ygopro.stoc_follow('REPLAY', true, function(buffer, info, client, server) { ygopro.stoc_follow('REPLAY', true, function(buffer, info, client, server) {
var duellog, dueltime, i, l, len2, len3, m, player, ref2, ref3, replay_filename, room; var duellog, dueltime, i, len3, len4, m, n, player, ref3, ref4, replay_filename, room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe; return settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe;
} }
if (settings.modules.cloud_replay.enabled && room.random_type) { if (settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled && !settings.modules.ygosharp.enabled && room.random_type) {
Cloud_replay_ids.push(room.cloud_replay_id); Cloud_replay_ids.push(room.cloud_replay_id);
} }
if (settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe) { if (settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe) {
...@@ -2654,15 +2718,15 @@ ...@@ -2654,15 +2718,15 @@
dueltime = moment().format('YYYY-MM-DD HH-mm-ss'); dueltime = moment().format('YYYY-MM-DD HH-mm-ss');
replay_filename = dueltime; replay_filename = dueltime;
if (room.hostinfo.mode !== 2) { if (room.hostinfo.mode !== 2) {
ref2 = room.dueling_players;
for (i = l = 0, len2 = ref2.length; l < len2; i = ++l) {
player = ref2[i];
replay_filename = replay_filename + (i > 0 ? " VS " : " ") + player.name;
}
} else {
ref3 = room.dueling_players; ref3 = room.dueling_players;
for (i = m = 0, len3 = ref3.length; m < len3; i = ++m) { for (i = m = 0, len3 = ref3.length; m < len3; i = ++m) {
player = ref3[i]; player = ref3[i];
replay_filename = replay_filename + (i > 0 ? " VS " : " ") + player.name;
}
} else {
ref4 = room.dueling_players;
for (i = n = 0, len4 = ref4.length; n < len4; i = ++n) {
player = ref4[i];
replay_filename = replay_filename + (i > 0 ? (i === 2 ? " VS " : " & ") : " ") + player.name; replay_filename = replay_filename + (i > 0 ? (i === 2 ? " VS " : " & ") : " ") + player.name;
} }
} }
...@@ -2675,11 +2739,11 @@ ...@@ -2675,11 +2739,11 @@
replay_filename: replay_filename, replay_filename: replay_filename,
roommode: room.hostinfo.mode, roommode: room.hostinfo.mode,
players: (function() { players: (function() {
var len4, n, ref4, results; var len5, o, ref5, results;
ref4 = room.dueling_players; ref5 = room.dueling_players;
results = []; results = [];
for (n = 0, len4 = ref4.length; n < len4; n++) { for (o = 0, len5 = ref5.length; o < len5; o++) {
player = ref4[n]; player = ref5[o];
results.push({ results.push({
name: player.name + (settings.modules.tournament_mode.show_ip && !player.is_local ? " (IP: " + player.ip.slice(7) + ")" : "") + (settings.modules.tournament_mode.show_info && !(room.hostinfo.mode === 2 && player.pos % 2 > 0) ? " (Score:" + room.scores[player.name] + " LP:" + (player.lp != null ? player.lp : room.hostinfo.start_lp) + (room.hostinfo.mode !== 2 ? " Cards:" + (player.card_count != null ? player.card_count : room.hostinfo.start_hand) : "") + ")" : ""), name: player.name + (settings.modules.tournament_mode.show_ip && !player.is_local ? " (IP: " + player.ip.slice(7) + ")" : "") + (settings.modules.tournament_mode.show_info && !(room.hostinfo.mode === 2 && player.pos % 2 > 0) ? " (Score:" + room.scores[player.name] + " LP:" + (player.lp != null ? player.lp : room.hostinfo.start_lp) + (room.hostinfo.mode !== 2 ? " Cards:" + (player.card_count != null ? player.card_count : room.hostinfo.start_hand) : "") + ")" : ""),
winner: player.pos === room.winner winner: player.pos === room.winner
...@@ -2696,7 +2760,7 @@ ...@@ -2696,7 +2760,7 @@
} }
}); });
} }
if (settings.modules.cloud_replay.enabled) { if (settings.modules.cloud_replay.enabled && !settings.modules.ygosharp.enabled) {
ygopro.stoc_send_chat(client, "${cloud_replay_delay_part1}R#" + room.cloud_replay_id + "${cloud_replay_delay_part2}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${cloud_replay_delay_part1}R#" + room.cloud_replay_id + "${cloud_replay_delay_part2}", ygopro.constants.COLORS.BABYBLUE);
} }
return settings.modules.tournament_mode.block_replay_to_player; return settings.modules.tournament_mode.block_replay_to_player;
...@@ -2707,9 +2771,9 @@ ...@@ -2707,9 +2771,9 @@
if (settings.modules.random_duel.enabled) { if (settings.modules.random_duel.enabled) {
setInterval(function() { setInterval(function() {
var l, len2, room, time_passed; var len3, m, room, time_passed;
for (l = 0, len2 = ROOM_all.length; l < len2; l++) { for (m = 0, len3 = ROOM_all.length; m < len3; m++) {
room = ROOM_all[l]; room = ROOM_all[m];
if (!(room && room.started && room.random_type && room.last_active_time && room.waiting_for_player)) { if (!(room && room.started && room.random_type && room.last_active_time && room.waiting_for_player)) {
continue; continue;
} }
...@@ -2729,9 +2793,9 @@ ...@@ -2729,9 +2793,9 @@
if (settings.modules.mycard.enabled) { if (settings.modules.mycard.enabled) {
setInterval(function() { setInterval(function() {
var l, len2, room, time_passed; var len3, m, room, time_passed;
for (l = 0, len2 = ROOM_all.length; l < len2; l++) { for (m = 0, len3 = ROOM_all.length; m < len3; m++) {
room = ROOM_all[l]; room = ROOM_all[m];
if (!(room && room.started && room.arena && room.last_active_time && room.waiting_for_player)) { if (!(room && room.started && room.arena && room.last_active_time && room.waiting_for_player)) {
continue; continue;
} }
...@@ -2785,7 +2849,7 @@ ...@@ -2785,7 +2849,7 @@
return callback + "( " + text + " );"; return callback + "( " + text + " );";
}; };
requestListener = function(request, response) { requestListener = function(request, response) {
var archive_args, archive_name, archive_process, check, death_room_found, duellog, error, filename, getpath, l, len2, len3, len4, len5, m, n, o, oppo_pos, parseQueryString, pass_validated, player, ref2, replay, room, roomsjson, u, win_pos; var archive_args, archive_name, archive_process, check, death_room_found, duellog, error, filename, getpath, len3, len4, len5, len6, m, n, o, oppo_pos, p, parseQueryString, pass_validated, player, ref3, replay, room, roomsjson, u, win_pos;
parseQueryString = true; parseQueryString = true;
u = url.parse(request.url, parseQueryString); u = url.parse(request.url, parseQueryString);
pass_validated = u.query.pass === settings.modules.http.password; pass_validated = u.query.pass === settings.modules.http.password;
...@@ -2797,10 +2861,10 @@ ...@@ -2797,10 +2861,10 @@
response.writeHead(200); response.writeHead(200);
roomsjson = JSON.stringify({ roomsjson = JSON.stringify({
rooms: (function() { rooms: (function() {
var l, len2, results; var len3, m, results;
results = []; results = [];
for (l = 0, len2 = ROOM_all.length; l < len2; l++) { for (m = 0, len3 = ROOM_all.length; m < len3; m++) {
room = ROOM_all[l]; room = ROOM_all[m];
if (room && room.established) { if (room && room.established) {
results.push({ results.push({
pid: room.process.pid.toString(), pid: room.process.pid.toString(),
...@@ -2809,11 +2873,11 @@ ...@@ -2809,11 +2873,11 @@
roommode: room.hostinfo.mode, roommode: room.hostinfo.mode,
needpass: (room.name.indexOf('$') !== -1).toString(), needpass: (room.name.indexOf('$') !== -1).toString(),
users: (function() { users: (function() {
var len3, m, ref2, results1; var len4, n, ref3, results1;
ref2 = room.players; ref3 = room.players;
results1 = []; results1 = [];
for (m = 0, len3 = ref2.length; m < len3; m++) { for (n = 0, len4 = ref3.length; n < len4; n++) {
player = ref2[m]; player = ref3[n];
if (player.pos != null) { if (player.pos != null) {
results1.push({ results1.push({
id: (-1).toString(), id: (-1).toString(),
...@@ -2853,9 +2917,9 @@ ...@@ -2853,9 +2917,9 @@
archive_name = moment().format('YYYY-MM-DD HH-mm-ss') + ".zip"; archive_name = moment().format('YYYY-MM-DD HH-mm-ss') + ".zip";
archive_args = ["a", "-mx0", "-y", archive_name]; archive_args = ["a", "-mx0", "-y", archive_name];
check = false; check = false;
ref2 = duel_log.duel_log; ref3 = duel_log.duel_log;
for (l = 0, len2 = ref2.length; l < len2; l++) { for (m = 0, len3 = ref3.length; m < len3; m++) {
replay = ref2[l]; replay = ref3[m];
check = true; check = true;
archive_args.push(replay.replay_filename); archive_args.push(replay.replay_filename);
} }
...@@ -2953,8 +3017,8 @@ ...@@ -2953,8 +3017,8 @@
return; return;
} }
if (u.query.shout) { if (u.query.shout) {
for (m = 0, len3 = ROOM_all.length; m < len3; m++) { for (n = 0, len4 = ROOM_all.length; n < len4; n++) {
room = ROOM_all[m]; room = ROOM_all[n];
if (room && room.established) { if (room && room.established) {
ygopro.stoc_send_chat_to_room(room, u.query.shout, ygopro.constants.COLORS.YELLOW); ygopro.stoc_send_chat_to_room(room, u.query.shout, ygopro.constants.COLORS.YELLOW);
} }
...@@ -2989,8 +3053,8 @@ ...@@ -2989,8 +3053,8 @@
response.end(addCallback(u.query.callback, "['ban ok', '" + u.query.ban + "']")); response.end(addCallback(u.query.callback, "['ban ok', '" + u.query.ban + "']"));
} else if (u.query.death) { } else if (u.query.death) {
death_room_found = false; death_room_found = false;
for (n = 0, len4 = ROOM_all.length; n < len4; n++) { for (o = 0, len5 = ROOM_all.length; o < len5; o++) {
room = ROOM_all[n]; room = ROOM_all[o];
if (!(room && room.established && room.started && !room.death && (u.query.death === "all" || u.query.death === room.port.toString()))) { if (!(room && room.established && room.started && !room.death && (u.query.death === "all" || u.query.death === room.port.toString()))) {
continue; continue;
} }
...@@ -3050,8 +3114,8 @@ ...@@ -3050,8 +3114,8 @@
} }
} else if (u.query.deathcancel) { } else if (u.query.deathcancel) {
death_room_found = false; death_room_found = false;
for (o = 0, len5 = ROOM_all.length; o < len5; o++) { for (p = 0, len6 = ROOM_all.length; p < len6; p++) {
room = ROOM_all[o]; room = ROOM_all[p];
if (!(room && room.established && room.started && room.death && (u.query.deathcancel === "all" || u.query.deathcancel === room.port.toString()))) { if (!(room && room.established && room.started && room.death && (u.query.deathcancel === "all" || u.query.deathcancel === room.port.toString()))) {
continue; continue;
} }
......
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