Commit 0dba1239 authored by nanahira's avatar nanahira

new mycard create room param

parent b8f324de
...@@ -254,6 +254,9 @@ init = () -> ...@@ -254,6 +254,9 @@ init = () ->
if settings.modules.http.quick_death_rule == true if settings.modules.http.quick_death_rule == true
settings.modules.http.quick_death_rule = 1 settings.modules.http.quick_death_rule = 1
imported = true imported = true
else if settings.modules.http.quick_death_rule == false
settings.modules.http.quick_death_rule = 2
imported = true
#import the old passwords to new admin user system #import the old passwords to new admin user system
if settings.modules.http.password if settings.modules.http.password
log.info('Migrating http user.') log.info('Migrating http user.')
...@@ -2137,7 +2140,9 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)-> ...@@ -2137,7 +2140,9 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
create_room_with_action = (buffer, decrypted_buffer, match_permit)-> create_room_with_action = (buffer, decrypted_buffer, match_permit)->
if client.closed if client.closed
return return
action = buffer.readUInt8(1) >> 4 firstByte = buffer.readUInt8(1)
action = firstByte >> 4
opt0 = firstByte & 0xf
if buffer != decrypted_buffer and action in [1, 2, 4] if buffer != decrypted_buffer and action in [1, 2, 4]
ygopro.stoc_die(client, '${invalid_password_unauthorized}') ygopro.stoc_die(client, '${invalid_password_unauthorized}')
return return
...@@ -2160,17 +2165,18 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)-> ...@@ -2160,17 +2165,18 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
options = { options = {
lflist: settings.hostinfo.lflist lflist: settings.hostinfo.lflist
time_limit: settings.hostinfo.time_limit time_limit: settings.hostinfo.time_limit
rule: (opt1 >> 5) & 3 rule: (opt1 >> 5) & 0x7 # 0 1 2 3 4
mode: (opt1 >> 3) & 3 mode: (opt1 >> 3) & 0x3 # 0 1 2
duel_rule: (if !!((opt1 >> 2) & 1) then 4 else 5) duel_rule: opt0 >> 1 # 1 2 3 4 5
no_check_deck: !!((opt1 >> 1) & 1) no_check_deck: !!((opt1 >> 1) & 1)
no_shuffle_deck: !!(opt1 & 1) no_shuffle_deck: !!(opt1 & 1)
start_lp: opt2 start_lp: opt2
start_hand: opt3 >> 4 start_hand: opt3 >> 4
draw_count: opt3 & 0xF draw_count: opt3 & 0xF
no_watch: settings.hostinfo.no_watch no_watch: settings.hostinfo.no_watch
auto_death: settings.hostinfo.auto_death auto_death: !!(opt0 & 0x1) ? 40 : false
} }
#console.log(options)
options.lflist = _.findIndex lflists, (list)-> ((options.rule == 1) == list.tcg) and list.date.isBefore() options.lflist = _.findIndex lflists, (list)-> ((options.rule == 1) == list.tcg) and list.date.isBefore()
room_title = info.pass.slice(8).replace(String.fromCharCode(0xFEFF), ' ') room_title = info.pass.slice(8).replace(String.fromCharCode(0xFEFF), ' ')
if badwordR.level3.test(room_title) if badwordR.level3.test(room_title)
......
...@@ -336,6 +336,9 @@ ...@@ -336,6 +336,9 @@
if (settings.modules.http.quick_death_rule === true) { if (settings.modules.http.quick_death_rule === true) {
settings.modules.http.quick_death_rule = 1; settings.modules.http.quick_death_rule = 1;
imported = true; imported = true;
} else if (settings.modules.http.quick_death_rule === false) {
settings.modules.http.quick_death_rule = 2;
imported = true;
} }
//import the old passwords to new admin user system //import the old passwords to new admin user system
if (settings.modules.http.password) { if (settings.modules.http.password) {
...@@ -2823,11 +2826,13 @@ ...@@ -2823,11 +2826,13 @@
return (checksum & 0xFF) === 0; return (checksum & 0xFF) === 0;
}; };
create_room_with_action = async function(buffer, decrypted_buffer, match_permit) { create_room_with_action = async function(buffer, decrypted_buffer, match_permit) {
var action, len2, m, name, opt1, opt2, opt3, options, player, ref, room, room_title, title; var action, firstByte, len2, m, name, opt0, opt1, opt2, opt3, options, player, ref, ref1, room, room_title, title;
if (client.closed) { if (client.closed) {
return; return;
} }
action = buffer.readUInt8(1) >> 4; firstByte = buffer.readUInt8(1);
action = firstByte >> 4;
opt0 = firstByte & 0xf;
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}');
return; return;
...@@ -2851,17 +2856,20 @@ ...@@ -2851,17 +2856,20 @@
options = { options = {
lflist: settings.hostinfo.lflist, lflist: settings.hostinfo.lflist,
time_limit: settings.hostinfo.time_limit, time_limit: settings.hostinfo.time_limit,
rule: (opt1 >> 5) & 3, rule: (opt1 >> 5) & 0x7, // 0 1 2 3 4
mode: (opt1 >> 3) & 3, mode: (opt1 >> 3) & 0x3, // 0 1 2
duel_rule: (!!((opt1 >> 2) & 1) ? 4 : 5), duel_rule: opt0 >> 1, // 1 2 3 4 5
no_check_deck: !!((opt1 >> 1) & 1), no_check_deck: !!((opt1 >> 1) & 1),
no_shuffle_deck: !!(opt1 & 1), no_shuffle_deck: !!(opt1 & 1),
start_lp: opt2, start_lp: opt2,
start_hand: opt3 >> 4, start_hand: opt3 >> 4,
draw_count: opt3 & 0xF, draw_count: opt3 & 0xF,
no_watch: settings.hostinfo.no_watch, no_watch: settings.hostinfo.no_watch,
auto_death: settings.hostinfo.auto_death auto_death: (ref = !!(opt0 & 0x1)) != null ? ref : {
40: false
}
}; };
//console.log(options)
options.lflist = _.findIndex(lflists, function(list) { options.lflist = _.findIndex(lflists, function(list) {
return ((options.rule === 1) === list.tcg) && list.date.isBefore(); return ((options.rule === 1) === list.tcg) && list.date.isBefore();
}); });
...@@ -2900,9 +2908,9 @@ ...@@ -2900,9 +2908,9 @@
} }
room = (await ROOM_find_or_create_by_name('M#' + info.pass.slice(8))); room = (await ROOM_find_or_create_by_name('M#' + info.pass.slice(8)));
if (room) { if (room) {
ref = room.get_playing_player(); ref1 = room.get_playing_player();
for (m = 0, len2 = ref.length; m < len2; m++) { for (m = 0, len2 = ref1.length; m < len2; m++) {
player = ref[m]; player = ref1[m];
if (!(player && player.name === client.name)) { if (!(player && player.name === client.name)) {
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