Commit 6df616b8 authored by nanahira's avatar nanahira

update checksum use

parent 33a6b9fc
...@@ -2305,15 +2305,15 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)-> ...@@ -2305,15 +2305,15 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
checksum += buf.readUInt8(i) checksum += buf.readUInt8(i)
(checksum & 0xFF) == 0 (checksum & 0xFF) == 0
create_room_with_action = (buffer, decrypted_buffer)-> create_room_with_action = (buffer)->
if client.isClosed if client.isClosed
return return
firstByte = buffer.readUInt8(1) firstByte = buffer.readUInt8(1)
action = firstByte >> 4 action = firstByte >> 4
opt0 = firstByte & 0xf 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
# 1 create public room # 1 create public room
# 2 create private room # 2 create private room
...@@ -2469,9 +2469,9 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)-> ...@@ -2469,9 +2469,9 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
if decrypted_buffer if decrypted_buffer
break break
if !decrypted_buffer if !decrypted_buffer
ygopro.stoc_die(client, '${invalid_password_checksum}') ygopro.stoc_die(client, '${invalid_password_unauthorized}')
return return
return create_room_with_action(buffer, decrypted_buffer) return create_room_with_action(decrypted_buffer)
else if settings.modules.challonge.enabled else if settings.modules.challonge.enabled
if info.version != settings.version and settings.alternative_versions.includes(info.version) if info.version != settings.version and settings.alternative_versions.includes(info.version)
......
...@@ -3037,7 +3037,7 @@ ...@@ -3037,7 +3037,7 @@
} }
return (checksum & 0xFF) === 0; return (checksum & 0xFF) === 0;
}; };
create_room_with_action = async function(buffer, decrypted_buffer) { create_room_with_action = async function(buffer) {
var action, e, firstByte, len2, m, matchPermitRes, match_permit, name, opt0, opt1, opt2, opt3, options, player, ref, ref1, room, room_title, title; var action, e, firstByte, len2, m, matchPermitRes, match_permit, name, opt0, opt1, opt2, opt3, options, player, ref, ref1, room, room_title, title;
if (client.isClosed) { if (client.isClosed) {
return; return;
...@@ -3045,10 +3045,10 @@ ...@@ -3045,10 +3045,10 @@
firstByte = buffer.readUInt8(1); firstByte = buffer.readUInt8(1);
action = firstByte >> 4; action = firstByte >> 4;
opt0 = firstByte & 0xf; opt0 = firstByte & 0xf;
if (buffer !== decrypted_buffer && (action === 1 || action === 2 || action === 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
}
// 1 create public room // 1 create public room
// 2 create private room // 2 create private room
// 3 join room by id // 3 join room by id
...@@ -3245,10 +3245,10 @@ ...@@ -3245,10 +3245,10 @@
} }
} }
if (!decrypted_buffer) { if (!decrypted_buffer) {
ygopro.stoc_die(client, '${invalid_password_checksum}'); ygopro.stoc_die(client, '${invalid_password_unauthorized}');
return; return;
} }
return create_room_with_action(buffer, decrypted_buffer); return create_room_with_action(decrypted_buffer);
} else if (settings.modules.challonge.enabled) { } else if (settings.modules.challonge.enabled) {
if (info.version !== settings.version && settings.alternative_versions.includes(info.version)) { if (info.version !== settings.version && settings.alternative_versions.includes(info.version)) {
info.version = settings.version; info.version = settings.version;
......
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