Commit 2d7cc987 authored by nanahira's avatar nanahira

Merge branch 'master' into tcg_random

parents da08b167 26a869f2
...@@ -3627,18 +3627,19 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server, datas)-> ...@@ -3627,18 +3627,19 @@ ygopro.ctos_follow 'UPDATE_DECK', true, (buffer, info, client, server, datas)->
struct.set("sidec", 1) struct.set("sidec", 1)
struct.set("deckbuf", [4392470, 4392470]) struct.set("deckbuf", [4392470, 4392470])
ygopro.stoc_send_chat(client, "${deck_incorrect_reconnect}", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, "${deck_incorrect_reconnect}", ygopro.constants.COLORS.RED)
else if room.duel_stage == ygopro.constants.DUEL_STAGE.BEGIN and settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.deck_check and fs.readdirSync(settings.modules.tournament_mode.deck_path).length else if room.duel_stage == ygopro.constants.DUEL_STAGE.BEGIN and settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.deck_check
decks = await fs.promises.readdir(settings.modules.tournament_mode.deck_path)
if decks.length
struct.set("mainc", 1) struct.set("mainc", 1)
struct.set("sidec", 1) struct.set("sidec", 1)
struct.set("deckbuf", [4392470, 4392470]) struct.set("deckbuf", [4392470, 4392470])
buffer = struct.buffer buffer = struct.buffer
found_deck=false found_deck=false
decks=fs.readdirSync(settings.modules.tournament_mode.deck_path)
for deck in decks for deck in decks
if deck_name_match(deck, client.name) if deck_name_match(deck, client.name)
found_deck=deck found_deck=deck
if found_deck if found_deck
deck_text=fs.readFileSync(settings.modules.tournament_mode.deck_path+found_deck,{encoding:"ASCII"}) deck_text = await fs.promises.readFile(settings.modules.tournament_mode.deck_path+found_deck,{encoding:"ASCII"})
deck_array=deck_text.split("\n") deck_array=deck_text.split("\n")
deck_main=[] deck_main=[]
deck_side=[] deck_side=[]
...@@ -4227,7 +4228,7 @@ if true ...@@ -4227,7 +4228,7 @@ if true
response.end(addCallback(u.query.callback, "['密码错误', 0]")) response.end(addCallback(u.query.callback, "['密码错误', 0]"))
return return
death_room_found = false death_room_found = false
_async.each(rooms, (room, done)-> _async.each(ROOM_all, (room, done)->
if !(room and (u.query.deathcancel == "all" or u.query.deathcancel == room.process_pid.toString() or u.query.deathcancel == room.name)) if !(room and (u.query.deathcancel == "all" or u.query.deathcancel == room.process_pid.toString() or u.query.deathcancel == room.name))
done() done()
return return
......
...@@ -4838,13 +4838,14 @@ ...@@ -4838,13 +4838,14 @@
struct.set("deckbuf", [4392470, 4392470]); struct.set("deckbuf", [4392470, 4392470]);
ygopro.stoc_send_chat(client, "${deck_incorrect_reconnect}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${deck_incorrect_reconnect}", ygopro.constants.COLORS.RED);
} }
} else if (room.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN && settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.deck_check && fs.readdirSync(settings.modules.tournament_mode.deck_path).length) { } else if (room.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN && settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.deck_check) {
decks = (await fs.promises.readdir(settings.modules.tournament_mode.deck_path));
if (decks.length) {
struct.set("mainc", 1); struct.set("mainc", 1);
struct.set("sidec", 1); struct.set("sidec", 1);
struct.set("deckbuf", [4392470, 4392470]); struct.set("deckbuf", [4392470, 4392470]);
buffer = struct.buffer; buffer = struct.buffer;
found_deck = false; found_deck = false;
decks = fs.readdirSync(settings.modules.tournament_mode.deck_path);
for (j = 0, len = decks.length; j < len; j++) { for (j = 0, len = decks.length; j < len; j++) {
deck = decks[j]; deck = decks[j];
if (deck_name_match(deck, client.name)) { if (deck_name_match(deck, client.name)) {
...@@ -4852,9 +4853,9 @@ ...@@ -4852,9 +4853,9 @@
} }
} }
if (found_deck) { if (found_deck) {
deck_text = fs.readFileSync(settings.modules.tournament_mode.deck_path + found_deck, { deck_text = (await fs.promises.readFile(settings.modules.tournament_mode.deck_path + found_deck, {
encoding: "ASCII" encoding: "ASCII"
}); }));
deck_array = deck_text.split("\n"); deck_array = deck_text.split("\n");
deck_main = []; deck_main = [];
deck_side = []; deck_side = [];
...@@ -4886,6 +4887,7 @@ ...@@ -4886,6 +4887,7 @@
ygopro.stoc_send_chat(client, `${client.name}\${deck_not_found}`, ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, `${client.name}\${deck_not_found}`, ygopro.constants.COLORS.RED);
} }
} }
}
return false; return false;
}); });
...@@ -5612,7 +5614,7 @@ ...@@ -5612,7 +5614,7 @@
return; return;
} }
death_room_found = false; death_room_found = false;
_async.each(rooms, function(room, done) { _async.each(ROOM_all, function(room, done) {
if (!(room && (u.query.deathcancel === "all" || u.query.deathcancel === room.process_pid.toString() || u.query.deathcancel === room.name))) { if (!(room && (u.query.deathcancel === "all" || u.query.deathcancel === room.process_pid.toString() || u.query.deathcancel === room.name))) {
done(); done();
return; return;
......
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