Commit 302680f1 authored by nanahira's avatar nanahira

half refa seed thing

parent 2dc01d77
Pipeline #37794 passed with stages
in 10 minutes and 2 seconds
...@@ -1194,9 +1194,6 @@ SOCKET_flush_data = global.SOCKET_flush_data = (sk, datas) -> ...@@ -1194,9 +1194,6 @@ SOCKET_flush_data = global.SOCKET_flush_data = (sk, datas) ->
await ygopro.helper.send(sk, buffer) await ygopro.helper.send(sk, buffer)
return true return true
getSeedTimet = global.getSeedTimet = (count) ->
return _.range(count).map(() => 0)
class Room class Room
constructor: (name, @hostinfo) -> constructor: (name, @hostinfo) ->
@name = name @name = name
...@@ -1365,12 +1362,11 @@ class Room ...@@ -1365,12 +1362,11 @@ class Room
@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]
if firstSeed if firstSeed
param.push(firstSeed) # first seed is number[8], so we have to make it base64
seeds = getSeedTimet(2) firstSeedBuf = Buffer.allocUnsafe(firstSeed.length * 4)
param.push(seeds[i]) for i in [0...2] for i in [0...firstSeed.length]
else firstSeedBuf.writeUInt32LE(firstSeed[i], i * 4)
seeds = getSeedTimet(3) param.push(firstSeedBuf.toString('base64'))
param.push(seeds[i]) for i in [0...3]
try try
@process = spawn './ygopro', param, {cwd: 'ygopro'} @process = spawn './ygopro', param, {cwd: 'ygopro'}
...@@ -1515,7 +1511,7 @@ class Room ...@@ -1515,7 +1511,7 @@ class Room
return false return false
try try
@recover_replay = await ReplayParser.fromFile(settings.modules.tournament_mode.replay_path + @recover_duel_log.replayFileName) @recover_replay = await ReplayParser.fromFile(settings.modules.tournament_mode.replay_path + @recover_duel_log.replayFileName)
@spawn(@recover_replay.header.seed) @spawn(@recover_replay.header.seed) # TODO: refa header.seed
return true return true
catch e catch e
log.warn("LOAD RECOVER REPLAY FAIL", e.toString()) log.warn("LOAD RECOVER REPLAY FAIL", e.toString())
......
// Generated by CoffeeScript 2.6.1 // Generated by CoffeeScript 2.6.1
(function() { (function() {
// 标准库 // 标准库
var CLIENT_get_absolute_pos, CLIENT_get_authorize_key, CLIENT_get_kick_reconnect_target, CLIENT_get_partner, CLIENT_heartbeat_register, CLIENT_heartbeat_unregister, CLIENT_import_data, CLIENT_is_able_to_kick_reconnect, CLIENT_is_able_to_reconnect, CLIENT_is_banned_by_mc, CLIENT_is_player, CLIENT_kick, CLIENT_kick_reconnect, CLIENT_pre_reconnect, CLIENT_reconnect, CLIENT_reconnect_register, CLIENT_reconnect_unregister, CLIENT_send_pre_reconnect_info, CLIENT_send_reconnect_info, CLIENT_send_replays, CLIENT_send_replays_and_kick, Q, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_clear_disconnect, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_pid, 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_kick, ROOM_player_flee, ROOM_player_get_score, ROOM_player_lose, ROOM_player_win, ROOM_players_oppentlist, ROOM_unwelcome, ROOM_validate, ReplayParser, ResolveData, Room, SERVER_clear_disconnect, SERVER_kick, SOCKET_flush_data, _, _async, addCallback, athleticChecker, auth, axios, badwordR, badwords, ban_user, bunyan, challonge, checkFileExists, createDirectoryIfNotExists, crypto, dataManager, deck_name_match, dialogues, disconnect_list, exec, execFile, extra_mode_list, fs, geoip, getDuelLogQueryFromQs, getSeedTimet, get_memory_usage, http, httpRequestListener, importOldConfig, import_datas, init, ip6addr, lflists, loadJSON, loadJSONAsync, loadLFList, loadRemoteData, load_dialogues, load_tips, log, long_resolve_cards, memory_usage, merge, moment, moment_long_ago_string, moment_now, moment_now_string, neosRequestListener, net, netRequestHandler, os, osu, path, qs, real_windbot_server_ip, release_disconnect, report_to_big_brother, request, roomlist, rooms_count, setting_change, setting_get, setting_save, settings, spawn, spawnSync, spawn_windbot, tips, url, users_cache, util, wait_room_start, wait_room_start_arena, windbot_looplimit, windbot_process, windbots, ygopro, zlib; var CLIENT_get_absolute_pos, CLIENT_get_authorize_key, CLIENT_get_kick_reconnect_target, CLIENT_get_partner, CLIENT_heartbeat_register, CLIENT_heartbeat_unregister, CLIENT_import_data, CLIENT_is_able_to_kick_reconnect, CLIENT_is_able_to_reconnect, CLIENT_is_banned_by_mc, CLIENT_is_player, CLIENT_kick, CLIENT_kick_reconnect, CLIENT_pre_reconnect, CLIENT_reconnect, CLIENT_reconnect_register, CLIENT_reconnect_unregister, CLIENT_send_pre_reconnect_info, CLIENT_send_reconnect_info, CLIENT_send_replays, CLIENT_send_replays_and_kick, Q, ROOM_all, ROOM_bad_ip, ROOM_ban_player, ROOM_clear_disconnect, ROOM_connected_ip, ROOM_find_by_name, ROOM_find_by_pid, 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_kick, ROOM_player_flee, ROOM_player_get_score, ROOM_player_lose, ROOM_player_win, ROOM_players_oppentlist, ROOM_unwelcome, ROOM_validate, ReplayParser, ResolveData, Room, SERVER_clear_disconnect, SERVER_kick, SOCKET_flush_data, _, _async, addCallback, athleticChecker, auth, axios, badwordR, badwords, ban_user, bunyan, challonge, checkFileExists, createDirectoryIfNotExists, crypto, dataManager, deck_name_match, dialogues, disconnect_list, exec, execFile, extra_mode_list, fs, geoip, getDuelLogQueryFromQs, get_memory_usage, http, httpRequestListener, importOldConfig, import_datas, init, ip6addr, lflists, loadJSON, loadJSONAsync, loadLFList, loadRemoteData, load_dialogues, load_tips, log, long_resolve_cards, memory_usage, merge, moment, moment_long_ago_string, moment_now, moment_now_string, neosRequestListener, net, netRequestHandler, os, osu, path, qs, real_windbot_server_ip, release_disconnect, report_to_big_brother, request, roomlist, rooms_count, setting_change, setting_get, setting_save, settings, spawn, spawnSync, spawn_windbot, tips, url, users_cache, util, wait_room_start, wait_room_start_arena, windbot_looplimit, windbot_process, windbots, ygopro, zlib;
net = require('net'); net = require('net');
...@@ -1580,12 +1580,6 @@ ...@@ -1580,12 +1580,6 @@
return true; return true;
}; };
getSeedTimet = global.getSeedTimet = function(count) {
return _.range(count).map(() => {
return 0;
});
};
Room = class Room { Room = class Room {
constructor(name, hostinfo) { constructor(name, hostinfo) {
var death_time, draw_count, duel_rule, extra_mode_func, lflist, param, rule, start_hand, start_lp, time_limit; var death_time, draw_count, duel_rule, extra_mode_func, lflist, param, rule, start_hand, start_lp, time_limit;
...@@ -1774,19 +1768,15 @@ ...@@ -1774,19 +1768,15 @@
} }
spawn(firstSeed) { spawn(firstSeed) {
var e, i, j, l, param, seeds; var e, firstSeedBuf, i, j, param, ref;
param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, this.hostinfo.duel_rule, (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]; param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, this.hostinfo.duel_rule, (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];
if (firstSeed) { if (firstSeed) {
param.push(firstSeed); // first seed is number[8], so we have to make it base64
seeds = getSeedTimet(2); firstSeedBuf = Buffer.allocUnsafe(firstSeed.length * 4);
for (i = j = 0; j < 2; i = ++j) { for (i = j = 0, ref = firstSeed.length; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {
param.push(seeds[i]); firstSeedBuf.writeUInt32LE(firstSeed[i], i * 4);
}
} else {
seeds = getSeedTimet(3);
for (i = l = 0; l < 3; i = ++l) {
param.push(seeds[i]);
} }
param.push(firstSeedBuf.toString('base64'));
} }
try { try {
this.process = spawn('./ygopro', param, { this.process = spawn('./ygopro', param, {
...@@ -1815,10 +1805,10 @@ ...@@ -1815,10 +1805,10 @@
this.port = parseInt(data); this.port = parseInt(data);
_.each(this.players, (player) => { _.each(this.players, (player) => {
player.server.connect(this.port, '127.0.0.1', async function() { player.server.connect(this.port, '127.0.0.1', async function() {
var buffer, len, m, ref; var buffer, l, len, ref1;
ref = player.pre_establish_buffers; ref1 = player.pre_establish_buffers;
for (m = 0, len = ref.length; m < len; m++) { for (l = 0, len = ref1.length; l < len; l++) {
buffer = ref[m]; buffer = ref1[l];
await ygopro.helper.send(player.server, buffer); await ygopro.helper.send(player.server, buffer);
} }
player.established = true; player.established = true;
...@@ -2002,7 +1992,7 @@ ...@@ -2002,7 +1992,7 @@
} }
try { try {
this.recover_replay = (await ReplayParser.fromFile(settings.modules.tournament_mode.replay_path + this.recover_duel_log.replayFileName)); this.recover_replay = (await ReplayParser.fromFile(settings.modules.tournament_mode.replay_path + this.recover_duel_log.replayFileName));
this.spawn(this.recover_replay.header.seed); this.spawn(this.recover_replay.header.seed); // TODO: refa header.seed
return true; return true;
} catch (error1) { } catch (error1) {
e = error1; e = error1;
......
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